tomer 发表于 2014-11-20 09:42

抄了一段代码,报错


import base64
import StringIO
a="this a test"
b=base64.encodestring(a)
print(b)
import StringIO
ImportError: No module named 'StringIO'

Leo.Lee 发表于 2014-11-20 12:33

检查一下python 安装主目录下的lib目录下有没有StringIO.py文件,如果没有此文件的话, 重新安装,有这个文件的话,检查一下环境变量设置。

heyong45 发表于 2014-11-20 15:03

貌似这一段不用import StringIO吧

whitelotus19 发表于 2014-11-20 15:31

What’s New In Python 3.0
......
The StringIO and cStringIO modules are gone. Instead, import the io module and use io.StringIO or io.BytesIO for text and data respectively.
......

tomer 发表于 2014-11-21 12:31

还真的没有这个文件

wenhq 发表于 2014-11-21 17:30

python please output this command.
页: [1]
查看完整版本: 抄了一段代码,报错