问题描述:
操作按行读取txt文本时报\ufeff
for line in open('unionWords.txt', encoding='utf-8'):
print line
解决:
for line in open('unionWords.txt', encoding='utf-8'):
newline = line.encode('utf-8').decode('utf-8-sig') #解决\ufeff问题
print newline
问题描述:
操作按行读取txt文本时报\ufeff
for line in open('unionWords.txt', encoding='utf-8'):
print line
解决:
for line in open('unionWords.txt', encoding='utf-8'):
newline = line.encode('utf-8').decode('utf-8-sig') #解决\ufeff问题
print newline