what is char in python code example

Example 1: what does char mean in python

* for char simply means characters in Python

Example 2: python char at

>>> 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
>>>

Example 3: character in python

chr()	Converts an integer to a character
ord()	Converts a character to an integer

Tags:

Php Example