-4
try:
import sys
# For Python 3.0 and later
from urllib.request import urlopen
except ImportError:
# Fall back to Python 2's urllib2
import sys
from urllib2 import urlopen
def fetch_words(url):
html = urlopen(url)
print(html.read())
story_words = []
for line in html:
line_words = line.decode('utf-8').split()
for word in line_words:
story_words.append(word)
return story_words
def print_items(items):
for item in items:
print(item)
def main():
url = sys.argv[1]
words = fetch_words(url)
print_items(words)
if name == '__main__'
main()
您需要編輯問題的格式爲代碼。 – PrestonM