Python问题记录

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_33854260/article/details/79940378

1.ModuleNotFoundError: No module named 'cStringIO'

解决:从Python 3.0开始,StringIO和cStringIO模块已经取消。通过import io模块代替,分别使用io.String或io.BytesIO处理文本和数据。从Python 3邮件流文档能看到相关实现StringIO的代码为:

from io import StringIO  
from email.generator import Generator  
fp = StringIO()  
g = Generator(fp, mangle_from_=True, maxheaderlen=60)  
g.flatten(msg)  
text = fp.getvalue()  

2.快捷键Atl + G 可以快速定位到指定行。

3.连续的三引用符将字符串圈起,文本将按照原貌被储存:

“““This is an even

bigger string that

spans three lines

”””

猜你喜欢

转载自blog.csdn.net/qq_33854260/article/details/79940378