Skip to content

Instantly share code, notes, and snippets.

@a-eid
Created April 14, 2017 11:23
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save a-eid/923c8069afab064e655e906cd7136e41 to your computer and use it in GitHub Desktop.
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