How to Use ascii() Function in PythonPython Basics


The ascii() function returns a readable object(String, Tuple, List, etc).

Example

#!/usr/bin/python3
# -*- coding: UTF-8 -*-

print(ascii('ABC'))
print(ascii('DEF'))
print(ascii('HIJ'))

Output:

'ABC'
'DEF'
'HIJ'

Syntax

ascii(object)

Parameters

Name Description
object An object(like String, List, Tuple, Dictionary, etc).

Return Value

It returns a readable version of any object(String, Tuple, List, etc).

© 2024 Cheerlearn.com, all rights reserved. Privacy Policy | Contact Us