built-in functions of python

# print (abs(-1)) #Absolute value 
# print (all([1,2,'1']))# Take each value in the sequence and do a Boolean operation, as long as one is false, return false
# print (all('hello'))#return true
# print (all(""))#if the iterable is empty, also return true
# print (any(['0','2']))# As long as one is true, it is true
# print bin(2) # Decimal to binary
# print bool('') # Compute false 0 for boolean values, and boolean values ​​for null and None are both false
# print (bytes( 'Hello'))
#name = 'Hello'
# name='Hello'
#The following are all in Python3
# print(bytes(name,encoding='utf-8'))
# print(bytes(name, encoding='utf-8').decode('utf-8'))
# print(bytes(name,encoding='gbk'))
# print(bytes(name,encoding='gbk').decode('gbk '))
# print(bytes(name,encoding='ascii'))#ascii cannot encode Chinese#

print chr(10)#corresponding to ascii code table
#print dir(dict)#print what methods are under an object
#print (divmod(10,3))# Take the quotient and take the remainder, often used for paging functions
seasons = [ 'Spring', 'Summer', 'Fall', 'Winter']
print list( enumerate(seasons)) # The enumerate() function is used to combine a traversable data object (such as a list, tuple or string) into a sequence of indices, listing both the data and the data subscripts

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324884330&siteId=291194637