1 #input() 2 #print() 3 #int 4 #float 5 #dict(a=1,b=2) 6 #list('123') 7 #set() 8 #tuple() 9 #bool10 #type11 #id12 #len13 print(bool(''))14 print(bool(None))15 print(bool([]))16 print(bool({}))17 print(bool(()))18 print(bool(0))19 20 sum([1,2,3,4,5])21 max()22 min()23 print(round('1.999',2))#保留几位小数24 print(divmod(10,5))#取余数25 print(globals())#把当前文件中的所有的变量取出来26 print(locals())27 28 def abc():29 print(locals()) #取函数里面的所有的局部变量30 print(globals()) #取整个python文件里面的所有变量31 abc()32 33 print(chr(65)) #ascii码对应的字符34 print(ord('a')) #字符对应的ascii码35 36 d = {}37 l = []38 print(dir(d))#查看有哪些方法39 # print(help(l))40 41 enumerate #枚举42 l = ['a','b','c','d','e','f']43 44 #实现45 #a > =146 #b > =247 #c > =348 #d > =449 #e > =550 51 #第一种方法52 id = 153 for i in l:54 print('%s=>%s'%(i,id))55 id+=156 57 for id,i in enumerate(l,1):58 print('%s->%s'%(id,i))59 60 l1=['xiaohei','xaobai','haha']61 l2=[110,120,130]62 res = list(zip(l1,l2)) #把list整合到一起63 print(res)64 print(dict(res))#由于是一对一的关系,所以可以转换成字典65 运行结果:[('xiaohei', 110), ('xaobai', 120), ('haha', 130)]66 { 'xiaohei': 110, 'xaobai': 120, 'haha': 130}