发布时间:2019-08-28 09:06:24编辑:auto阅读(1844)
#!/usr/bin/python
#coding:utf-8
import os
import string
import sys, getopt
def Grep_start_char(Mpath, char):
if os.path.exists(Mpath):
GrepFile = file(Mpath)
else:
return "No such file or directory"
try:
for line in hosts:
if line.startswith(char) or line.strip() == '':
continue
print line
finally:
hosts.close()
if __name__ == '__main__':
#opts,args = getopt.getopt(sys.argv[1:],'')
Mpath = raw_input('input file path: ')
char = raw_input('input grep char: ')
if Mpath and char:
Grep_start_char(Mpath, char)
上一篇: python : 'builtin_fu
下一篇: python编译表达式方法compile
51369
50842
41431
38227
32723
29621
28438
23344
23286
21615
1702°
2430°
2031°
1968°
2312°
1995°
2705°
4527°
4346°
3099°