【python】BytesIO与串化

一共有以下几个概念

1、类文件: File(path), open(path), BytesIO(), ... 文件读之前要seek(0)

2、字符串: file.read()

3、对象: dict, pdfObject, 

 

相互转换:

对象到文件: cPickle.dump(object, f)

文件到字符串:f.seek(0),  f.read()

对象到字符串: cPickle.dumps(object)

字符串到文件: f.write(str), 

文件到对象:cPickle.load(f)

字符串到对象:cPickle.loads(str)

posted on 2019-01-15 17:18  yesuuu  阅读(1625)  评论(0编辑  收藏  举报

导航