Skip to content

Instantly share code, notes, and snippets.

@jackyshan
Created December 6, 2016 06:18
Show Gist options
  • Save jackyshan/5cee0dd18653f04e5edd8f2d94dc94c0 to your computer and use it in GitHub Desktop.
Save jackyshan/5cee0dd18653f04e5edd8f2d94dc94c0 to your computer and use it in GitHub Desktop.
Python查找当前目录下文件的匹配内容
import os
for file in os.listdir(os.getcwd()):
f = open(file)
content = f.readline()
while content:
if 'xxx' in content :
print content
pass
content = f.readline()
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment