我有几个文本,我想知道行号和文件中出现一个单词。在
我把文件弄得很好,但行号没有。在
这是地图
#!/usr/bin/env python
import sys
import os
find = 'but' #word to find
linesCont = 0
file = os.environ["map_input_file"]
for line in sys.stdin:
line = line.strip()
words = line.split()
linesCont = linesCont + 1;
for word in words:
if (word in (find)):
print '%s\t%s' % (file, linesCont)
而且是减少
^{pr2}$事先非常感谢
Here是在Apache论坛上的一个讨论。Another在SO中查询。here是一个代码段,用于获取正在处理的块的文件名。在
相关问题 更多 >
编程相关推荐