Ascii () function in Python
In Python, the ascii () function returns a string containing the representation of the object that can print. It ignores non-ASCII values in the string using x, u or U.
In Python, the ascii () function returns a string containing the representation of the object that can print. It ignores non-ASCII values in the string using x, u or U.
Syntax of ascii () function in Python:
ascii(object)
Parameters of ascii () function:
The function ascii () has only one object parameter (such as string, list, .).
What value does the function ascii () return?
It returns a string containing the representation of the object that is printable.
For example, ö will be converted to xf6, √ will become u221a, Š will become u0152.
Values other than ASCII will be replaced by x, u or U.
Example of ascii () function:
In the example below, we will try some ASCII characters and see what the ascii () function will return:
danhsach = ['Python','PŸTHON','√', 'ö','Pythön', 'Š', 'Œ','Ž',10, '©']
print(ascii(danhsach))
After running the above program, we get the following output:
['Python', 'Pu0178THON', 'u221a', 'xf6', 'Pythxf6n', 'u0160', 'u0152', 'u017d', 10, 'xa9']
You can see a list of built-in Python functions and don't forget to do Python exercises to reinforce your knowledge.
You should read it
- ASCII function in SQL Server
- What is ASCII? The ASCII code is standard and complete
- The ord () function in Python
- CHAR function in SQL Server
- Int () function in Python
- The function dir () in Python
- Max () function in Python
- Zip () function in Python
- DATENAME function in SQL Server
- The function id () in Python
- Exec () function in Python
- The compile () function in Python
Maybe you are interested
Close-up of a diver's encounter with anaconda and piranha in the Brazilian river Hitman Sniper famous game is being free on iOS and Android How to record webcam videos on VLC Media Player 200 million year old dinosaur footprints are found in Africa Instructions for making your own heating fan for yourself, in the coming winter Russia has revealed: 8 photos of the Tu-160M2 heavy bomber