ch03: update from book draft

This commit is contained in:
Luciano Ramalho
2020-02-18 23:58:03 -03:00
parent aa868e8f75
commit 20dd93c11b
6 changed files with 16 additions and 16 deletions

View File

@@ -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[]