file operate in python (open write read close )
来源:互联网 发布:淘宝卖衣服从哪进货 编辑:程序博客网 时间:2024/06/10 22:04
1. file open:
fd = open(N1,N2):N1:path of the file to be open like '/home/warrior/Downloads/test.txt'
N2:some choiceable parameter
'r':read only 'w':write only 'r+':read and write 'a':write and will add content at the end of file
2. file read:
content = fd.read():read all content of the file
oneline = fd.readline():read one line content of the file
lastContent = fd.readlines():read the content from current vernier to the end of the file
3. file write:
fd.write(content):when opening in 'w' it will write content cover the original content
when opening in 'a' it will write content add at the end of the file but not start one new line again
fd.writelines(content): when opening in 'w' it will write content cover the original content
when opening in 'a' it will write content add at the end of the file and start one new line again
4. file close:
fd.close():when open one file must close it as you will not use it .
5. file others:
fd.seek(number):set the vernier of the file
fd = open(N1,N2):N1:path of the file to be open like '/home/warrior/Downloads/test.txt'
N2:some choiceable parameter
'r':read only 'w':write only 'r+':read and write 'a':write and will add content at the end of file
2. file read:
content = fd.read():read all content of the file
oneline = fd.readline():read one line content of the file
lastContent = fd.readlines():read the content from current vernier to the end of the file
3. file write:
fd.write(content):when opening in 'w' it will write content cover the original content
when opening in 'a' it will write content add at the end of the file but not start one new line again
fd.writelines(content): when opening in 'w' it will write content cover the original content
when opening in 'a' it will write content add at the end of the file and start one new line again
4. file close:
fd.close():when open one file must close it as you will not use it .
5. file others:
fd.seek(number):set the vernier of the file
0
上一篇:android studio logcat异常调试信息解析错误方法
下一篇:I/O of python (INPUT / OUTPUT)
相关热门文章
- python 自动化测试平台 Robot ...
- python 自动化测试平台 Robot ...
- python snmp 自动化2-在python...
- 自动化测试详细测试计划 模板...
- python snmp 自动化3-修改pyth...
- linux dhcp peizhi roc
- 关于Unix文件的软链接
- 求教这个命令什么意思,我是新...
- sed -e "/grep/d" 是什么意思...
- 谁能够帮我解决LINUX 2.6 10...
给主人留下些什么吧!~~
评论热议
0 0
- file operate in python (open write read close )
- open close write 跟read
- linux下 open() write() read() close函数
- linux open read write lseek close
- open、read、write、close函数应用实例
- linux下 open() write() read() close函数
- linux下 open() write() read() close函数
- linux下 open() write() read() close函数
- linux下 open() write() read() close函数
- linux下 open() write() read() close函数
- linux下 open() write() read() close函数
- linux下 open() write() read() close函数
- linux下 open() write() read() close函数
- open、close、read、write四个函数
- python read write file
- Liunx FS 高层函数 Create/Open/Close/Read/Write
- 文件I/O编程 (open、read、write、lseek、close)
- Linux基础编程-文件操作open,lseek,read,write,close
- MySQL的简单count查询(无where子句)
- QT中 QT_BEGIN_NAMESPACE、QT_END_NAMESPACE的应用介绍!!
- Qt标准对话框之QMessageBox
- RelativeLayout与LinearLayout的比较
- android studio logcat异常调试信息解析错误方法
- file operate in python (open write read close )
- I/O of python (INPUT / OUTPUT)
- 正则表达式
- sublime text2对编译无反应的解决办法
- function summary of nltk in python
- spark RDD
- android 存储结构与存储方法
- Spark 中算子功能与分类介绍
- spark standalone mode
原创粉丝点击
热门IT博客
热门问题
老师的惩罚
人脸识别
我在镇武司摸鱼那些年
重生之率土为王
我在大康的咸鱼生活
盘龙之生命进化
天生仙种
凡人之先天五行
春回大明朝
姑娘不必设防,我是瞎子
片冈爱之助
我爱这片土地朗诵
我爱这片土地 艾青
我的爱就像一片云
爱片屋
爱密色一片
美国片爱的迷宫
一级爱片
欧美爱片
爱牙日
全国爱牙日
爱牙手抄报
爱牙日资料
爱牙库
世界爱牙日
爱牙
爱牙日主题
爱牙小诗歌
爱牙库商城
爱牙日手抄报
全国爱牙日手抄报
今天全国爱牙日
爱牙日手抄报简单漂亮
爱牙库牙科材料商城
爱牙护牙顺口溜
爱牙护牙手抄报
爱牙手抄报简单又漂亮
爱牙日手抄报内容
爱牙日宣传画
爱牙儿歌15字
爱牙日绘画大全
爱牙护牙手抄报图片
爱牙手抄报图片
2019爱牙日主题
精灵爱牙讲堂
世界爱牙日是几月几日
国际爱牙日图片
爱物
hers
2012香港我的爱物
爱特