| 
 
 
 
 enumerate, reversed, sorted, zipfilter, iter, mapabs, divmod, pow,  roundbin, chr, hex, oct, ord 
Draft for Information Only ContentPython Built-in Conversion Functions
 bin()Parameters
 Remarks
 
 chr()Parameters
 Remarks
 
 format()Parameters
 Remarks
 
 hex()Parameters
 Remarks
 
 oct()Parameters
 Remarks
 
 ord()Parameters
 Remarks
 Source and Reference
 
Python Built-in Conversion Functions
The Python interpreter has some built-in conversion functions.
     bin()
bin(𝑥)Parametersbin()to return a binary string prefixed with "0b".𝑥to specify the integer to be returned fromRemarksbin()convert an integer number to a binary string prefixed with "0b"If 𝑥 is not a Pyton intobject, it has to define an__index__()method that returns an integer.
 chr()
chr(𝑖)Parameterstype()to return the string representing the character specified by an Unicode code point.𝑖to specify the Unicode code point to be returned fromRemarkschr()is the inverse oford()The valid range for the argument 𝑖 is from 0 through 1,114,111 (0x10FFFF in base 16). ValueErrorwill be raised if 𝑖 is outside that range.
 format()
 format(value[, format_spec])Parametersformat()to return a formatted representation of specifiedvalue.valueto specify avalueto be returned from[format_spec]optional, to specify theformat_specof thevalueto be returned.RemarksThe interpretation of format_specwill depend on the type of thevalueargument, however there is a standard formatting syntax that is used by most built-in types: Format Specification Mini-Language.The default format_specis an empty string which usually gives the same effect as callingstr(value)A call to format(value, format_spec)is translated totype(value).__format__(value, format_spec)which bypasses the instance dictionary when searching for the value's__format__()method.A TypeErrorexeception is raised if the method search reachesobjectand theformat_specis non-empty, or if either theformat_specor the return value are not strings.
 hex()
hex(𝑥)Parametershex()to return a lowercase hexadecimal strig prefixed with0x.𝑥to specify the integer𝑥to be returned fromRemarkshex()converts an integer number to a lowercase hexadecimal string prefixed with0xIf 𝑥 is not a Python intobject, it has to define an__index__()method that returns an integer.To obtain a hexadecimal string representation for a float, use the float.hex() method.
 oct()
oct(𝑥)Parametersoct()to return an octal string prefixed with0ofrom an integer number.𝑥to specify an integer number to be returned fromRemarksThe result is a valid Python expressionif 𝑥is not a Pythonintobject, it has to define an__index__()method that returns an integer.
 ord()
ord(𝑐)Parametersord()to return an integer representing the Unicode code point of that character.𝑐to specify the string to be returned fromRemarksGiven a string representing one Unicode character, return an integer representing the Unicode code point of that character.This is the inverse of chr().
 Source and Reference©sideway
 
 ID: 201002802 Last Updated: 10/28/2020 Revision: 0 |  |