Scroll Down to See All▾
absaiterallanextanybinboolbreakpointbytearraybytescallablechrclassmethodcompilecomplexdelattrdictdivmodenumerateevalexecfilterfloatformatfrozensetgetattrglobalshasattrhashhelphexidinputintisinstanceissubclassiterlenlistlocalsmapmaxmemoryviewminnextobjectoctopenordpowprintpropertyrangereprreversedroundsetsetattrslicesortedstaticmethodstrsumsupertupletypevarszip__import__clear_(dict)clear_(list)clear_(set)copy_(dict)copy_(list)copy_(set)fromkeysgetitemskeyspop_(dict)pop_(list)pop_(set)popitemsetdefaultupdatevaluescount_(tuple)count_(list)count_(str)index_(tuple)index_(list)index_(str)adddifferencedifference_updatediscardintersectionintersection_updateisdisjointissubsetissupersetremove_(set)remove_(list)symmetric_differencesymmetric_difference_updateunionupdateclosefilenoflushisattyreadreadablereadlinereadlinesseekseekabletelltruncatewritablewritewritelinesappendextendinsertreversesortcapitalizecasefoldcenterencodeendswithexpandtabsfindformatisalnumisalphaisasciiisdecimalisdigitisidentifierislowerisnumericisprintableisspaceistitleisupperjoinljustlowerlstripmaketranspartitionreplacerfindrindexrjustrpartitionrsplitrstripsplitsplitlinesstartswithstripswapcasetitletranslateupperdirzfillFunction Details: ascii
Description
Returns a string containing a printable representation of an object, escaping non-ASCII characters.
Extended Description
The ascii() function returns a string representation of an object, similar to repr(), but escapes the non-ASCII characters in the string with \x, \u or \U escapes. This can be useful when you need a printable representation of an object that contains only ASCII characters.
Read More about ascii from Python Documentation
Function Signature
ascii(object: Any) -> str
Module: builtins
Parameters
This function takes one parameter: object (any Python object). The function will return a string representation of this object.
Parameter List
- object: Any
Return
Returns a string containing a printable representation of the object, with non-ASCII characters escaped.
Return Type
str
Output
Explanation
This example shows how ascii() handles both ASCII and non-ASCII strings, including Unicode characters.