我有一个文本文档,我正在尝试查找退货并用逗号替换它们。我不断收到语法错误,最后的打印功能被突出显示,但我不知道出了什么问题。
orders = []
try:
with open('vlc.txt') as data:
for each_line in data:
try:
each_line.replace("/n", ",")
order = order.strip()
orders.append(order)
except ValueError:
pass
with open("vlc_clean.txt","wb") as vlc_file:
pickle.dump(orders, vlc_file)
except IOError as err:
print('File Error: ' + str(err))
except pickle.PickleError as perr:
print('Pickling error: ' + str(perr)
print(orders)