Last active
August 29, 2015 14:12
-
-
Save anna-hope/8a9e9b0774afd6d3ee6f to your computer and use it in GitHub Desktop.
only small letters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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