New submission from Srikanth <s4srika...@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:
-------------
s1='Hello'
s2=' World '
s3=' How are you ? '
print(s1, s2, "\n", s3, "\n")
print('---------------------------')
print('Long time ' 'No see mate ')
print("Hope ", 'All is ' "good")
print('---------------------------')
print(s1, 'World'," !!")
print((s1+s2+s3)*2," there ?")


Output:
--------
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@python
components: Documentation
files: Python_Docs_3.1.2_String_Concatination.py
messages: 347754
nosy: Deshpande, docs@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue37575>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to