First ensure the necessary number is a valid index for the string from starting or end , at that point you can just utilize array subscript notation. use len(s) to get string length
>>> s = "python"
>>> s[3]
'h'
>>> s[6]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: string index out of range
>>> s[0]
'p'
>>> s[-1]
'n'
>>> s[-6]
'p'
>>> s[-7]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: string index out of range
>>>
Are you pretty much interested to learn python in detail? Come and join the python training course to gain more knowledge.
To know more about this you can have a look at the following video tutorial:-