Conversion Functions
Convert between types using built-in functions.
str(42) # "42"int("7") # 7float("3.14") # 3.14Character conversion is useful for building sector IDs (A1, B2, etc.):
chr(65) # "A"chr(66) # "B"ord("A") # 65Example: generate sector names.
row = 0while row < 8: letter = chr(65 + row) sector = letter + str(1) print(sector) # A1, B1, C1... row = row + 1See also
Section titled “See also”- Built-in Functions: full conversion reference (
str,int,float,chr,ord,hex,bin,oct,repr, and constructors)