Kaydet (Commit) 78a5722a authored tarafından Will White's avatar Will White Kaydeden (comit) Mariatta

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.
üst 0f86cd38
...@@ -212,6 +212,13 @@ to each other are automatically concatenated. :: ...@@ -212,6 +212,13 @@ to each other are automatically concatenated. ::
>>> 'Py' 'thon' >>> 'Py' 'thon'
'Python' 'Python'
This feature is particularly useful when you want to break long strings::
>>> text = ('Put several strings within parentheses '
... 'to have them joined together.')
>>> text
'Put several strings within parentheses to have them joined together.'
This only works with two literals though, not with variables or expressions:: This only works with two literals though, not with variables or expressions::
>>> prefix = 'Py' >>> prefix = 'Py'
...@@ -227,13 +234,6 @@ If you want to concatenate variables or a variable and a literal, use ``+``:: ...@@ -227,13 +234,6 @@ If you want to concatenate variables or a variable and a literal, use ``+``::
>>> prefix + 'thon' >>> prefix + 'thon'
'Python' 'Python'
This feature is particularly useful when you want to break long strings::
>>> text = ('Put several strings within parentheses '
... 'to have them joined together.')
>>> text
'Put several strings within parentheses to have them joined together.'
Strings can be *indexed* (subscripted), with the first character having index 0. Strings can be *indexed* (subscripted), with the first character having index 0.
There is no separate character type; a character is simply a string of size There is no separate character type; a character is simply a string of size
one:: one::
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment