您的位置:首页 > 编程语言 > Python开发

python学习笔记

2017-07-12 13:37 218 查看
`open`

Character     Meaning       'r'       open for reading (default)    'w'       open for writing, truncating the file first    'x'       create a new file and open it for writing    'a'       open for writing, appending to the end of the file if it exists    'b'       binary mode    't'       text mode (default)    '+'       open a disk file for updating (reading and writing)    'U'       universal newline mode (deprecated)


open
接受Unix-style风格和典型的windows风格的斜杆。

open(r'C:\sss\sss.py')
open('C:/xx/xx.py')
open('C:\\xx\\xx.py')



open的写入方式都是Strings,若需要存储Native Python Objects, 使用Pickle module  

pickle.dump(data,file)
data=pickle.load(file)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  学习笔记 python