ch03: update from book draft
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
# http://www.aleax.it/Python/accu04_Relearn_Python_alex.pdf
|
||||
# (slide 41) Ex: lines-by-word file index
|
||||
|
||||
# BEGIN INDEX_DEFAULT
|
||||
# tag::INDEX_DEFAULT[]
|
||||
"""Build an index mapping word -> list of occurrences"""
|
||||
|
||||
import sys
|
||||
@@ -23,4 +23,4 @@ with open(sys.argv[1], encoding='utf-8') as fp:
|
||||
# print in alphabetical order
|
||||
for word in sorted(index, key=str.upper):
|
||||
print(word, index[word])
|
||||
# END INDEX_DEFAULT
|
||||
# end::INDEX_DEFAULT[]
|
||||
|
||||
Reference in New Issue
Block a user