def callback(arg, directory, files):
for file in files:
if fnmatch.fnmatch(file,arg):
for line in fileinput.input(os.path.abspath(os.path.join(directory, file)),inplace=1):
if re.search('.*theunderdogs.*', line): # I changed * to .* but it would probably work without this if
line = string.replace(line,'theunderdogs','the-underdogs') # old string , new string
print line,
评论列表
文章目录