python学习笔记
2017-07-12 13:37
218 查看
`open`
open
接受Unix-style风格和典型的windows风格的斜杆。
open的写入方式都是Strings,若需要存储Native Python Objects, 使用Pickle module
pickle.dump(data,file)
data=pickle.load(file)
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学习笔记:Python Language Features
- Boost.Python学习笔记
- Python 学习笔记 - 4.if 表达式
- python文件读写实例学习笔记
- Python 学习笔记(1)
- python(异常处理机制,学习笔记摘要)
- python学习笔记(1)
- python学习笔记,整形,字符串
- Python学习笔记1
- Python学习笔记
- if __name__ (python学习笔记一,注意前面是双下划线)
- python学习笔记(二)
- python学习笔记(2)
- python学习笔记1
- Python学习笔记(一)
- [原创]Ruby学习笔记(4)-闰年、季节和月份天数的Ruby版和Python版
- Python学习笔记 Module
- Python 正则式学习笔记
- Python 学习笔记 - 2.自省