Created
May 4, 2013 12:25
-
-
Save harrifeng/5517345 to your computer and use it in GitHub Desktop.
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
def print_file(path = "test.txt"): | |
"""print every word in the file | |
Arguments: | |
- `path`: file name | |
""" | |
mapped = dict() | |
with open(path, 'r') as f: | |
for line in f: | |
# print line.rstrip('\r\n') | |
for word in [x for x in line.rstrip('\r\n').split(' ') if len(x) > 0]: | |
print word | |
if __name__ == '__main__': | |
print_file('test.txt') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment