Created
April 14, 2017 11:23
-
-
Save a-eid/923c8069afab064e655e906cd7136e41 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import sys | |
from urllib.request import urlopen | |
def fetch_words(url): | |
words = [] | |
with urlopen(url) as f: | |
for line in f: | |
for word in line.decode('utf-8').split(): | |
words.append(word) | |
return words | |
def print_items(items): | |
for item in items: | |
print(item) | |
def main(url): | |
print_items(fetch_words(url)) | |
if(__name__ == "__main__"): | |
main(sys.argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment