Python直接读取中文路径的文件时失败,可做如下处理:
inpath = 'D:/work/yuanxx/在线导航/驾车导航/walk_log/20130619_172355.txt'
uipath = unicode(ipath , "utf8")
然后用"uipath"经过编码后的路径去open()即可:
fin = open(uipath)
Python直接读取中文路径的文件时失败,可做如下处理:
inpath = 'D:/work/yuanxx/在线导航/驾车导航/walk_log/20130619_172355.txt'
uipath = unicode(ipath , "utf8")
然后用"uipath"经过编码后的路径去open()即可:
fin = open(uipath)
转载于:https://www.cnblogs.com/whm-blog/p/7133090.html