发布时间:2019-09-08 09:10:54编辑:auto阅读(1498)
[root@localhost 1008]# cat test01.txt
1 3194 0 2013-11-15 19:25:47
1 696 0 2013-11-15 19:29:56
1 3194 0 2013-11-15 19:30:09
1 56 0 2013-11-15 19:30:25
1 1111 0 2013-11-15 19:31:41
1 56 0 2013-11-15 19:48:36
1 3160 0 2013-11-15 19:48:43
1 177 0 2013-11-15 19:48:50
1 3438 0 2013-11-15 19:49:02
1 118 0 2013-11-15 19:50:15
1 177 0 2013-11-15 19:50:34
1 3438 0 2013-11-15 19:50:38
#!/usr/bin/python
import fileinput
for line in fileinput.input('/script/python/1008/test01.txt',inplace=1):
line = line.replace('2013-11-15','zhang')
print line,
1 3194 0 zhangxz 19:25:47
1 696 0 zhangxz 19:29:56
1 3194 0 zhangxz 19:30:09
1 56 0 zhangxz 19:30:25
1 1111 0 zhangxz 19:31:41
1 56 0 zhangxz 19:48:36
1 3160 0 zhangxz 19:48:43
1 177 0 zhangxz 19:48:50
1 3438 0 zhangxz 19:49:02
1 118 0 zhangxz 19:50:15
1 177 0 zhangxz 19:50:34
1 3438 0 zhangxz 19:50:38
上一篇: python2.6 升级为 2.7
下一篇: Python07 列表、元组
47857
46422
37309
34755
29327
25986
24937
19964
19558
18045
5804°
6429°
5944°
5973°
7077°
5924°
5959°
6452°
6415°
7796°