Python Basic String Operations
kodingwindow@kw:~$ python3
...
>>> "KodingWindow"
'KodingWindow'

>>> 'KodingWindow'
'KodingWindow'

>>> print("KodingWindow")
KodingWindow

>>> print("\'KodingWindow\'")
'KodingWindow'

>>> print('\"KodingWindow\"')
"KodingWindow"

>>> print("Koding\nwindow")
Koding
window

>>> kw="KodingWindow"
>>> kw
'KodingWindow'

>>> len(kw)
12

>>> del kw
>>> kw
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'kw' is not defined
Strings Concatenation
>>> s1="Koding"
>>> s2="window"
>>> s1+s1
'KodingKoding'

>>> s1+s2
'KodingWindow'

>>> s1*5
'KodingKodingKodingKodingKoding'

>>> s1,s2
('Koding', 'window')
Escape Characters
>>> kw="Koding\nwindow"
>>> kw
'Koding\nwindow'

>>> kw="Koding\nwindow"
>>> print(kw)
Koding
window
 
>>> kw=r"Koding\nwindow"
>>> print(kw)
Koding\nwindow
 
>>> print('\"KodingWindow\"')
"KodingWindow"

>>> kw="Koding\twindow"
>>> print(kw)
Koding	window
Advertisement