Comment detail

LL Golf Hole 4 - 文章から単語の索引を作る (Nested Flatten)

空気読まずに、普通にGO

1
2
3
4
5
6
url = "http://www.gnu.org/licenses/gpl.txt"
dic = {}
for index, line in enumerate(urllib.urlopen(url)):
    for word in re.findall('\w+', line):
        dic.setdefault(word, []).append(index + 1)
print dic

Index

Feed

Other

Link

Pathtraq

loading...