国产精品chinese,色综合天天综合精品网国产在线,成午夜免费视频在线观看,清纯女学生被强行糟蹋小说

    <td id="ojr13"><tr id="ojr13"><label id="ojr13"></label></tr></td>
        • <source id="ojr13"></source>
            <td id="ojr13"><ins id="ojr13"><label id="ojr13"></label></ins></td>

            Article / 文章中心

            Python編程:StringIO和BytesIO內(nèi)存中讀寫操作

            發(fā)布時間:2021-11-23 點(diǎn)擊數(shù):589

            StringIO

            from io import StringIO  #像文件一樣寫入 f = StringIO() f.write("some words") f.write("other words") print(f.getvalue())  # some wordsother words f.close()  # 初始化,然后,像讀文件一樣讀取 f1 = StringIO("code") print(f1.read())  # code f1.close()

            BytesIO

            from io import BytesIO  fb = BytesIO() fb.write("中國".encode("utf-8")) fb.write("美麗".encode("utf-8")) print(fb.getvalue().decode("utf-8")) # 中國美麗 fb.close()  # 像讀文件一樣讀取 fb1 = BytesIO("中國".encode("utf-8")) print(fb1.read()) # b'\xe4\xb8\xad\xe5\x9b\xbd' fb1.close()