In Python, strings are immutable sequence of Unicode code points. One can write string literals in any of the following ways:
- Single quotes: 'allows embedded "double" quotes'
- Double quotes: "allows embedded 'single' quotes".
- Triple quoted: '''Triple quoted strings may extent to multiple lines’’’ “””- all associated white-space or blank space will be included in the string literal”””
Important Note: If there are string literals with only whitespace between them and are a part of any single expression than they will be implicitly converted to a single string literal. See the following example code piece.
>>> "Meetu " "Choudhary"
'Meetu Choudhary'
>>> print ("Meetu " "Choudhary" )
Meetu Choudhary
>>>
'Meetu Choudhary'
>>> print ("Meetu " "Choudhary" )
Meetu Choudhary
>>>
No comments:
Post a Comment