我尝试用 Python 读取 CSV 文件,但第一行的第一个元素是这样读取的 0
,而奇怪的字符不在文件中,它只是一个简单的 0
。这是我使用的代码:
matriceDist=[]
file=csv.reader(open("distanceComm.csv","r"),delimiter=";")
for row in file:
matriceDist.append(row)
print (matriceDist)
最佳答案
我遇到了同样的问题。将您的 excel 文件保存为 CSV (MS-DOS) 与 UTF-8 相比,那些奇怪的字符应该会消失。
关于python - 读取 CSV 文件时出现奇怪的字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50228008/