参考:StringIO和BytesIO NOTE 1.StringIO: 顾名思义就是在内存中读写str. #!/usr/bin/env python from io import BytesIO as StringIO def main(): f = StringIO() f.write('Hi') f.write(' ') f.write('all') print(f.getvalue()) f1 = StringIO('Hi I am wasdns') s = f1.readline()…