ascii table python code example
Example 1: table to ascii python
from table2ascii import table2ascii
output = table2ascii(
header=["#", "G", "H", "R", "S"],
body=[["1", "30", "40", "35", "30"], ["2", "30", "40", "35", "30"]],
footer=["SUM", "130", "140", "135", "130"],
)
print(output)
"""
╔═════════════════════════════╗
║ # G H R S ║
╟─────────────────────────────╢
║ 1 30 40 35 30 ║
║ 2 30 40 35 30 ║
╟─────────────────────────────╢
║ SUM 130 140 135 130 ║
╚═════════════════════════════╝
"""
Example 2: python ascii
>>> ord('a')
97
>>> chr(97)
'a'
>>> chr(ord('a') + 3)
'd'
>>>
Example 3: ascii values in python of
c = 'p'
print("The ASCII value of '" + c + "' is", ord(c))