Chinaunix

标题: 抄了一段代码,报错 [打印本页]

作者: tomer    时间: 2014-11-20 09:42
标题: 抄了一段代码,报错

  1. import base64
  2. import StringIO
  3. a="this a test"
  4. b=base64.encodestring(a)
  5. 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.




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2