Skip to content

Commit bc7799d

Browse files
committed
Separate join and list comprehension
1 parent b9b5021 commit bc7799d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

docs/writing/structure.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,8 @@ with calls to append().
445445
.. code-block:: python
446446
447447
# create a concatenated string from 0 to 19 (e.g. "012..1819")
448-
print "".join([str(n) for n in range(20)])
448+
nums = [str(n) for n in range(20)]
449+
print "".join(nums)
449450
450451
One final thing to mention about strings is that using join() is not always
451452
best. In the instances where you are creating a new string from a pre-determined

0 commit comments

Comments
 (0)