django StringIO出错

python version=3.6

提出问题

from io import StringIO
sio = StringIO.StringIO()

错误提示:

AttributeError: type object '_io.StringIO' has no attribute 'StringIO'

解决办法

from io import StringIO
sio = StringIO()

参考链接

AttributeError: type object '_io.StringIO' has no attribute 'StringIO'

支付宝红包码,你领红包我赚赏金;土豪请任意收钱码打赏

你可能感兴趣的:(django StringIO出错)