Я пытаюсь выяснить, как вставить несколько строк в Python, но получаю ошибку:
TypeError: («Параметры должны быть в списке, кортеже или строке», «HY000»')
for folderName in os.listdir(parentDirectory):
for fileName in os.listdir(parentDirectory+'/'+folderName+'/'+'people'):
if os.path.splitext(fileName)[-1].lower()== '.xml':
filePath = parentDirectory+'/'+folderName+'/'+'people'+'/'+fileName
print(filePath)
tree = ET.parse(filePath)
valuesToInsert.append("('" + fileName + "','" +tree.find('PNumber').text+ "','" +tree.find('PNumber2').text+ "')")
numberOfProcessedFiles += 1
if numberOfProcessedFiles%1000 == 0:
print(*valuesToInsert, sep = "\n")
cursor.executemany('''
insert into t02.m.PNumbers
values
(?,?,?)
''',valuesToInsert)
conn.commit()
valuesToInsert.clear()