Skip to content

Commit 4675049

Browse files
Ken KundertKen Kundert
authored andcommitted
doc: misc refinements
1 parent dc5345c commit 4675049

File tree

3 files changed

+5
-20
lines changed

3 files changed

+5
-20
lines changed

doc/techniques.rst

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -163,23 +163,8 @@ As shown below, this code outputs the data twice, the first time with the
163163
de-duplicated keys and the second time using the original keys. Notice that the
164164
first contains the duplication markers whereas the second does not.
165165

166-
.. code-block:: nestedtext
167-
168-
With de-duplicated keys:
169-
Michael Jordan:
170-
occupation: basketball player
171-
Michael Jordan#2:
172-
occupation: actor
173-
Michael Jordan#3:
174-
occupation: football player
175-
176-
With original keys:
177-
Michael Jordan:
178-
occupation: basketball player
179-
Michael Jordan:
180-
occupation: actor
181-
Michael Jordan:
182-
occupation: football player
166+
.. literalinclude:: ../examples/deduplication/michael_jordan.out
167+
:language: nestedtext
183168

184169

185170
.. _sorting keys:

examples/deduplication/michael_jordan

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def de_dup(key, state):
88
if key not in state:
99
state[key] = 1
1010
state[key] += 1
11-
return f"{key}#{state[key]}"
11+
return f"{key} #{state[key]}"
1212

1313
try:
1414
# read contacts database

examples/deduplication/michael_jordan.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
DE-DUPLICATED KEYS:
22
Michael Jordan:
33
occupation: basketball player
4-
Michael Jordan#2:
4+
Michael Jordan #2:
55
occupation: actor
6-
Michael Jordan#3:
6+
Michael Jordan #3:
77
occupation: football player
88

99
ORIGINAL KEYS:

0 commit comments

Comments
 (0)