In python, strings are arrays of bytes representing unicode character. however, python does not have a character data type, a single character is simply a string with length 1.
square brackets [] used for access element of string.
In python create a string using " " or ' ' or ''' '''(for multiple line)
st=' '
st=" "
st=''' '''
string=[i] ; where i is only interger otherwise typeerror
In python, updation or deletion of a character from a string not allowed becoz string is immutable.
but deletion of entire string is possible by del keyword.
string='python'
string[0]='p' #type error
\' = '
\" = "
\\ = \\
Raw string...
string='Ankit \x48'
print(string) #output= Ankit H
string=r'Ankit \x48
print(string) #output= Ankit \x48
...both string are difference second is called raw string after multiply by r
Formating of string...
string in python can be formatted with the use of farmat() method which is very versatile.
e.g. string='{:>8}'.format('ankit')
print(string) #output=___ankit
e.g. string='{:<8}'.format('ankit')
print(string) #output=ankit___
e.g. string='{:^8}'.format('ankit')
print(string) #output= __ankit)_
string='{:b}'.format(4)
print(string) #ouput=100
string='{:.2f}'.format(1/6)
print(string) #ouput=0.17
string='{:e}'.format(164.58)
print(string) #1.6458e+02
and similary you can try other