Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 78a5722

Browse files
Will WhiteMariatta
authored andcommitted
Improve the String tutorial docs (GH-4541)
The paragraph that contains example of string literal concatenation was placed after the section about concatenation using the '+' sign. Moved the paragraph to the appropriate section.
1 parent 0f86cd3 commit 78a5722

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

Doc/tutorial/introduction.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,13 @@ to each other are automatically concatenated. ::
212212
>>> 'Py' 'thon'
213213
'Python'
214214

215+
This feature is particularly useful when you want to break long strings::
216+
217+
>>> text = ('Put several strings within parentheses '
218+
... 'to have them joined together.')
219+
>>> text
220+
'Put several strings within parentheses to have them joined together.'
221+
215222
This only works with two literals though, not with variables or expressions::
216223

217224
>>> prefix = 'Py'
@@ -227,13 +234,6 @@ If you want to concatenate variables or a variable and a literal, use ``+``::
227234
>>> prefix + 'thon'
228235
'Python'
229236

230-
This feature is particularly useful when you want to break long strings::
231-
232-
>>> text = ('Put several strings within parentheses '
233-
... 'to have them joined together.')
234-
>>> text
235-
'Put several strings within parentheses to have them joined together.'
236-
237237
Strings can be *indexed* (subscripted), with the first character having index 0.
238238
There is no separate character type; a character is simply a string of size
239239
one::

0 commit comments

Comments
 (0)