Python直接读取中文路径的文件时失败,可做如下处理:
inpath = ‘D:/work/yuanxx/在线导航/驾车导航/walk_log/20130619_172355.txt‘
uipath = unicode(ipath , "utf8")
然后用"uipath"经过编码后的路径去open()即可:
fin = open(uipath)
时间: 2024-10-03 23:18:27
Python直接读取中文路径的文件时失败,可做如下处理:
inpath = ‘D:/work/yuanxx/在线导航/驾车导航/walk_log/20130619_172355.txt‘
uipath = unicode(ipath , "utf8")
然后用"uipath"经过编码后的路径去open()即可:
fin = open(uipath)