Skip to content

Instantly share code, notes, and snippets.

@anna-hope
Last active August 29, 2015 14:12
Show Gist options
  • Save anna-hope/8a9e9b0774afd6d3ee6f to your computer and use it in GitHub Desktop.
Save anna-hope/8a9e9b0774afd6d3ee6f to your computer and use it in GitHub Desktop.
only small letters
#!/usr/bin/env python3.4
from itertools import filterfalse
from sys import argv
try:
filepath = argv[1]
except IndexError:
raise SystemExit('must specify path to file')
with open(filepath) as myfile:
corpus = myfile.read().splitlines()
only_small = filterfalse(lambda x: x[0].isupper(), corpus)
with open('result.txt', 'w') as newfile:
newfile.write('\n'.join(only_small))
print('over and out')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment