我的工作(法国)的PC上使用Python 3.4Python的os.popen和Unicode
for line in os.popen('dir'): print(line.rstrip())
我得到的第一行预期
Le volume dans le lecteur C s'appelle SYSTEME
但第二(与)
Lenumérode s rie du volume est C 250-47DD
我得到的错误信息:
return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u201a' in position 7: character maps to
<undefined>
我能做些什么? 在此先感谢您的帮助
你应该使用子*,因为不推荐使用2.6版本:此功能是过时*,或只使用OS .listdir。 – 2014-11-21 18:11:11