免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12
最近访问板块 发新帖
楼主: sullybear
打印 上一主题 下一主题

python 读一行就马上删除一行 [复制链接]

论坛徽章:
11
技术图书徽章
日期:2014-03-01 14:44:34天蝎座
日期:2014-05-21 22:11:59金牛座
日期:2014-05-30 17:06:14
11 [报告]
发表于 2014-02-28 15:46 |只看该作者
回复 10# q1208c
文档有说明
  1. Optional in-place filtering: if the keyword argument inplace=True is passed to fileinput.input() or to the FileInput constructor, the file is moved to a backup file and standard output is directed to the input file (if a file of the same name as the backup file already exists, it will be replaced silently). This makes it possible to write a filter that rewrites its input file in place. If the backup parameter is given (typically as backup='.<some extension>'), it specifies the extension for the backup file, and the backup file remains around; by default, the extension is '.bak' and it is deleted when the output file is closed. In-place filtering is disabled when standard input is read.
复制代码

论坛徽章:
33
荣誉会员
日期:2011-11-23 16:44:17天秤座
日期:2014-08-26 16:18:20天秤座
日期:2014-08-29 10:12:18丑牛
日期:2014-08-29 16:06:45丑牛
日期:2014-09-03 10:28:58射手座
日期:2014-09-03 16:01:17寅虎
日期:2014-09-11 14:24:21天蝎座
日期:2014-09-17 08:33:55IT运维版块每日发帖之星
日期:2016-04-17 06:23:27操作系统版块每日发帖之星
日期:2016-04-18 06:20:00IT运维版块每日发帖之星
日期:2016-04-24 06:20:0015-16赛季CBA联赛之天津
日期:2016-05-06 12:46:59
12 [报告]
发表于 2014-02-28 15:49 |只看该作者
回复 11# timespace


  
如果这也叫直接修改, 那我请问, 有多少修改是 "非直接" 的?

好吧, 我败了, 我闪还不行么.  

论坛徽章:
0
13 [报告]
发表于 2014-02-28 19:02 |只看该作者
我靠难道非得inode不变才能叫直接修改?楼主就是想读一行删一行你们非得加那么多定义限制。。。

论坛徽章:
0
14 [报告]
发表于 2014-02-28 19:04 |只看该作者
又看了一遍楼主的问题,根本就没出现“直接修改”这几个字嘛,达到目的不就行了

论坛徽章:
1
IT运维版块每日发帖之星
日期:2016-02-06 06:20:00
15 [报告]
发表于 2014-03-07 13:40 |只看该作者
这个可以好好关注一下
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP