Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 521d8e8

Browse files
authored
Merge branch 'master' into feat/py2-to-py3-in-code-style-section
2 parents 5796581 + 25a2c4e commit 521d8e8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎docs/writing/structure.rst‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ compute x + 1, you have to create another integer and give it a name.
788788
789789
my_list = [1, 2, 3]
790790
my_list[0] = 4
791-
printmy_list # [4, 2, 3] <- The same list has changed
791+
print(my_list) # [4, 2, 3] <- The same list has changed
792792
793793
x = 6
794794
x = x + 1 # The new x is another object
@@ -822,7 +822,7 @@ most idiomatic way to do this.
822822
nums = ""
823823
for n in range(20):
824824
nums += str(n) # slow and inefficient
825-
printnums
825+
print(nums)
826826
827827
**Better**
828828

@@ -832,15 +832,15 @@ most idiomatic way to do this.
832832
nums = []
833833
for n in range(20):
834834
nums.append(str(n))
835-
print"".join(nums) # much more efficient
835+
print("".join(nums)) # much more efficient
836836
837837
**Best**
838838

839839
.. code-block:: python
840840
841841
# create a concatenated string from 0 to 19 (e.g. "012..1819")
842842
nums = [str(n) for n in range(20)]
843-
print"".join(nums)
843+
print("".join(nums))
844844
845845
One final thing to mention about strings is that using ``join()`` is not always
846846
best. In the instances where you are creating a new string from a pre-determined

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /