发布于 2021-07-05 18:43:40
也许我可以试试这个:
import csv
import os 
base = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
csv_file open(base + "/any.csv", mode='r')
dialect = csv.excel()
dialect.delimiter = ';'
csv_reader = csv.DictReader(csv_file, dialect=dialect)
txt_file open(base + "/any.csv", mode='w') 
txt_file = txt.writer()
for row in csv_reader:
   txt_file.writerow((row, ))
txt_file.save()
txt_file.close()
csv_file.close()我希望它能帮助你,问候。
https://stackoverflow.com/questions/68254265
复制相似问题