IO编程

一StringIO和BytesIO

  原文地址:https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/001431918785710e86a1a120ce04925bae155012c7fc71e000

  应用场景:数据读写的不是文件,而是在内存中读写。

  StringIO顾名思义就是在内存中读写str。

  BytesIO就是在内存中读写二进制数据。

  方法:

    getvalue()

    f=BytesIO()

    f.write('')

    print(f.getvalue())

    

  

posted @ 2017-12-18 20:15  骑者赶路  阅读(142)  评论(0编辑  收藏  举报