[docs] [issue37575] Python Documentation on strings ( section 3.1.2.)

Srikanth report at bugs.python.org
Fri Jul 12 16:50:07 EDT 2019

New submission from Srikanth <s4srikanth at gmail.com>:

In section 3.1.2 of the python documentation, its mentioned as below:

Two or more string literals (i.e. the ones enclosed between quotes) next to each other are automatically concatenated.
This feature is particularly useful when you want to break long strings:
This only works with two literals though, not with variables or expressions:

However, the concatination operation works on variables and expressions also.
Please find the below python code snippet and the output:

Python Code:
s2=' World '
s3=' How are you ? '
print(s1, s2, "\n", s3, "\n")
print('Long time ' 'No see mate ')
print("Hope ", 'All is ' "good")
print(s1, 'World'," !!")
print((s1+s2+s3)*2," there ?")

Hello  World                                                                                                          
  How are you ?                                                                                                       
Long time No see mate                                                                                                 
Hope  All is good                                                                                                     
Hello World  !!                                                                                                       
Hello World  How are you ? Hello World  How are you ?   there ?

assignee: docs at python
components: Documentation
files: Python_Docs_3.1.2_String_Concatination.py
messages: 347754
nosy: Deshpande, docs at python
priority: normal
severity: normal
status: open
title: Python Documentation on strings ( section 3.1.2.)
type: resource usage
Added file: https://bugs.python.org/file48474/Python_Docs_3.1.2_String_Concatination.py

Python tracker <report at bugs.python.org>

More information about the docs mailing list