Skip to content

Instantly share code, notes, and snippets.

@GaryLee
Created November 29, 2016 16:16
Show Gist options
  • Select an option

  • Save GaryLee/52b48224de4e1edaef6cbddb83e4bfdc to your computer and use it in GitHub Desktop.

Select an option

Save GaryLee/52b48224de4e1edaef6cbddb83e4bfdc to your computer and use it in GitHub Desktop.
List all text files.
#!python
import glob
for fn in glob.glob('*.txt'):
with open(fn, 'r') as fd:
for ln, content in enumerate(fd):
print '%s:%d> %s' % (fn, ln, content),
print '\n'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment