#abs函数, Absolute
#all函数, the parameter passed in is a sequence, and only if all the elements in the list are true, then what is true?
#None, ' empty string, [] empty list, {} empty dictionary, 0 false
#any函数, the passed in parameter is also a sequence, so long as one element is true, the result is true
#bin, convert a decimal number to a binary number
#oct, convert a decimal into octal
#hex, convert a decimal to hexadecimal
#bool, view a Boolean value for a parameter
# ret = bool (0)
# Print (ret)
# # False
# ret = bool (None)
# Print (ret)
# # False
# ret = bool (1)
# Print (ret)
# # True
#bytes函数, Utf-8 encoding, a Chinese character is 3 bytes, GBK encoded, a Chinese character is 2 bytes, you can convert a string to a byte type
s = ' Zidane '
x = bytes (s,encoding= ' Utf-8 ')
Print (x)
# b ' \xe9\xbd\x90\xe8\xbe\xbe\xe5\x86\x85 '
x = bytes (s,encoding= ' GBK ')
Print (x)
# b ' \xc6\xeb\xb4\xef\xc4\xda '
#str函数, convert bytes to Strings
#callable, whether it can be executed, returns true if it can be executed, or false if it cannot
f = Lambda a:a-1
L = [n/A]
Print (callable (f))
Print (Callable (L))
# True
# False
#ord, convert a character to Ascil code, CHR is to convert a ascil code character
Print (Ord (' A '))
Print (Chr (65))
# 97
# A
#这里在介绍一个random的函数, a random number can be generated, which is useful when generating a verification code, via random
#函数产生随机的数字, and then convert the random number to the corresponding Ascil code by the CHR function
Import Random
ret = Random.randint (1,34)
Print (ret)
#dict, create the function's
#dir
#divmod, quotient and remainder
# ret = Divmod (7,3)
# Print (ret)
#enumerate, you can add a sequence to the output
Li = [' abc ', ' CDA ', ' afe ']
# for I in Li:
# Print (i)
# ABC
# CDA
# AFE
# for I,item in Enumerate (li,1):
# Print (I,item)
# 1 ABC
# 2 CDA
# 3 Afe
Def show ():
Print (' a ')
return [11,33,44]
Print (' B ')
ret = Show ()
Print (ret)
Def show ():
Print (' a ')
if 1 = = 2:
return [' A ', ' B ']
Print (' B ')
ret = Show ()
Python built-in function