Reference: "Python 3 Program Development Guide"
integer Conversion Functions :
Bin (i) |
Returns the binary representation of the integer I (string) |
Hex (i) |
Returns the hexadecimal representation of I (String) |
int (x) |
Converts an X to an integer, fails to produce an ValueError exception, the data type of x does not know that the conversion of an integer produces an typeerror exception, and X is a floating-point number to intercept an integral part |
Int (x,base) |
Converts the x represented by the base into decimal, such as int (' 74 ', 8) returns 60,int (' A4 ', 16) returns 164 |
Oct (i) |
Returns the octal representation of I, such as the OCT (10) = = ' 012 ' |
String slices:
There are 3 types of syntax for slicing operations:
Seq[start]
Seq[start:end]
Seq[start:end:step]
SEQ can be any sequence, such as a list, a string, or a meta-ancestor
>>> s= ' The waxwork man ' >>> s = s[:12] + ' wo ' + s[12:]>>> s ' The waxwork woman ' >>> s[::- 1] ' Namow krowxaw EhT '
Python data Types-notes for the Python 3 Program development Guide