python中的StringIO和 ByteIO
2017-08-16 09:44
232 查看
今天学习了文件中读写和内存中的读写
文件中读写用with open ('路径','r') as f :
print(f.read())
with open ('路径','r') as f :
f.write('写的内容')
在内存中读写则用StringIO
from io import StringIO
f = StringIO()
f.write('山雨欲来风满楼')
print(f.getvalue())
文件中读写用with open ('路径','r') as f :
print(f.read())
with open ('路径','r') as f :
f.write('写的内容')
在内存中读写则用StringIO
from io import StringIO
f = StringIO()
f.write('山雨欲来风满楼')
print(f.getvalue())
相关文章推荐
- 2017.6.19-python学习-stringIO和byteIo
- Python StringIO与cStringIO
- python中的StringIO模块
- python之StringIO
- python模块之StringIO
- [笔记]python的StringIO与BytesIO模块
- Python 7.2 StringIO和BytesIO
- python中的StringIO模块
- python StringIO和BytesIO
- Python StringIO模块(或Six.BytesIO()模块)实现在内存缓冲区中读写数据
- python模块之StringIO
- python StringIO和BytesIO
- python中的StringIO和cStringIO模块
- python的StringIO
- Python StringIO与cStringIO
- Python的StringIO模块和cStringIO模块
- Python字符串之StringIO和struct
- python 在内存中读写:StringIO / BytesIO
- [置顶] 【python StringIO模块】感受内存文件的速度优势
- 【Python】[IO编程]文件读写,StringIO和BytesIO,操作文件和目录,序列化