for foo in root.finadall(xpath):
print (foo.name[xpath], foo.country[xpath])
df = DataFrame({'Name': foo.name[xpath], 'conutry': foo.country[xpath]})
df.to_excel('foo.xlsx', sheet_name='sheet1', index=False)
Der Ausgang druckt die vielen Namen in der Konsole. Aber in Excel speichert es nur die kleinste. Wie speichere ich alle Namen im Excel.Schreiben Sie die Konsolenausgabe in Excel-Tabelle mit DataFrame Python
auf klare Vorstellung zu bekommen:
The console output:
Name Country
jennfier abc
andy john cde
carwl xyz
in Excel sehe ich die einzige carwl xyz.
Ich habe die Frage aktualisiert. – louis