AttributeError: type object '_io.StringIO' has no attribute 'StringIO'
时间:2016-09-28 19:17:24
收藏:0
阅读:1950
python2导入StringIO模块,直接:
from StringIO import StringIO
对于python3,StringIO和cStringIO模块已经没了,如果要使用的话,需要导入io模块:
from io import StringIO dot_data = StringIO()
你也可以导入six模块来使用StringIO:
from six import StringIO
from sklearn.externals.six import StringIO
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
原文:http://www.cnblogs.com/iamxyq/p/5917318.html
评论(0)