#===================================================== # l = [1,2,5,7,-1,100] # print(max(l)) # dic = {'age1':18,'age2':10} # print(max(dic)) # print(max(dic.values())) # print(max(zip(dic.values(),dic.keys()))) #===================================================== #阿斯克表 # print(chr(97)) # print(ord("a")) #===================================================== # print(pow(3,3))#3**3 三的三次方 # print(pow(3,3,2))#3**3%2 三的三次方除二(取余) #===================================================== # 翻转 #l = [1,2,3,4] # print(list(reversed(l))) # print(l) #===================================================== #四舍五入 # print(round(3.5)) #===================================================== #变成集合 形式 # print(set('hello')) #===================================================== #切片 slice提前定义切片 # l = 'hello' # s = slice(3,5) # s1= slice(1,4,2) # print(l[s1]) # 开始 # print(s1.start) # 停止 # print(s1.stop) # 步长 # print(s1.step) #===================================================== # 排序本质就是在比较大小 不同类型之间不能比较 # people = [ # {'name':'hello','age':1000}, # {'name':'shabi','age':123}, # {'name':'caonim','age':9000}, # {'name':'litinghui','age':18}, # ] # print(sorted(people,key=lambda dic:dic['age'])) # name_dic ={ # 'aenhen':1200, # 'shaha' :500, # 'gcaih' :2000, # } # print(sorted(name_dic))#按照人名排序 比较key的大小 # print(sorted(name_dic,key=lambda key:name_dic[key]))#按照key值排序 # print(sorted(zip(name_dic.values(),name_dic.keys())))#按照 key :values 取值 #===================================================== # str 转换成字符串 type 查看类型 # print(str('1')) # print(type(str({'a':1}))) # dic_str = str({'a':1}) # print(type(eval(dic_str))) #===================================================== # 求和 # l = [1,2,3,4,5,6,7,8,9] # print(sum(l)) #查看类型 # print(type(l)) #===================================================== #if type 类型判断 # msg = '123' # if type(msg) is str : # msg = int(msg) # res = msg+1 # print(res) #===================================================== # vars 如果不传参数 就等于locals # 如果传入一个参数 查看object 下所有方法以字典形式显示 # def test (): # msg = "所发生的十多个" # print(locals()) # print(vars()) # test() # print(vars()) # #=====================================================