Python built-in function two

Source: Internet
Author: User

s= "6*8"
A=eval (s)
print (a)
#filter与map
a=[10,20,30,40]
New_list=map (lambda x:x+10,a)
b=list (new_list)
print (b)
def x (b):
c=b+10
return C
C=map (x,a)
d=list (c)
print (d)
def bb (x):
if (x>=30):
return True
Else:
return False
C=filter (bb,a)
Print (list (c))
#frozenset Freeze Set set indicates that the set collection can only be queried and cannot be modified
Print (Globals ()) # Get all the global variables
print (Locals ()) #得到所有的局部变量
#hash used primarily for keys in a dictionary,
#hex (10) Get the corresponding 16 binary
#id () Get the address of this object
a=[1,2,3,4]
For B in Iter (a):
print (b)
B=max (1,3,2,10,32)
# print (b)
a=oct (8) #得到8进制
print (a)
B=pow (2,3)
print (b)
a=[1,2,3,45,51]
For i in range (0,5):
print (A[i])
Print (range (0,5)) #python2是直接输出0, 1,2,3,4,. The Python3 is optimized. Return a value only when data is needed
#repr calls itself the __repr__ () method
c=[1,2,3,4,5]
d=reversed (c)
Print (list (d))
B=round (4.6)
print (b)
b=sum ([3,4,5,6])
print (b)
#super like there's a parent class that has a method a ()
#你想调用A父类的A方法, you can use Super (). A ()
print (VARs ())
a=[1,2,3]
b=[4,5,6]
c=[7,8,9]
d=zip (a,b,c)
Print (list (d))

Python built-in function two

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.