from urllib.request import urlopen

fhand = urlopen('http://data.pr4e.org/romeo.txt')

cont = dict()
for linha in fhand:
    p = linha.decode().split()
    for palavra in p:
        cont[palavra] = cont.get(palavra, 0) + 1

print(cont)

from urllib.request import urlopen

fhand = urlopen('http://data.pr4e.org/romeo.txt')

cont = dict()
for linha in fhand:
    p = linha.decode().split()
    for palavra in p:
        cont[palavra] = cont.get(palavra, 0) + 1

print(cont)
