Built-in functions are much more, just record the next part today.
ABS ()
Seek absolute value
>>> ABS ( -10.1)
All () is true, parameters are iterative
>>> All ([12,3,4,5, None]) False
Any () is true, it is true
>>> any ([12,3,4,5, None]) True
BOOL () Boolean value
>>> bool (1) True>>> bool (0) False
ASCII () automatic execution of __repr__ objects
Chestnuts:
class Foo: def __repr__ (self): return " 444 " = ASCII (Foo ())print(n)print(Bin (5))print (Oct (9))print(hex) Result:4440b1010o110xf
Bin () Turn binary
Oct () goto octal
Hex () Turn hex
Data type:
0b means binary
0o means octal
0x indicates hexadecimal
Bytes () Converts a string to a byte type
Bytes () generally followed by encoding= ' character encoding, for example: bytes (' Li Jie ', encoding= ' utf-8 ')
Chestnuts:
>>> bytes (' kanji ', encoding='UTF8') b' \xe6\xb1\x89\xe5\xad\x97'>>> bytes (' kanji ', encoding='gbk') b'\xba\xba\xd7\xd6'
Encoding UTF-8: A kanji account of three bytes
Encoding GBK: A kanji account of two bytes
Bytecode deserialization, using the str command:
Chestnuts:
Name=bytes (' li Jie ', encoding='UTF-8')print (name) new_name=str (bytes (name), encoding='UTF-8')Print (new_name)
Results:
b'\xe6\x9d\x8e\xe6\x9d\xb0' li Jie
Built-in function one of Python basics