# Author:FengFeng
age_dic = {'feng_age1':15,'ming_age4':14,'rong_age3':16,'ze_age2':70}
print(max(age_dic.values()))
print(max(age_dic))#此时会自动根据key比较
z = list(max(zip(age_dic.values(),age_dic.keys())))
for item in zip(age_dic.values(),age_dic.keys()):
print(item)
print(z)
#不同类型之间不能进行比较
people = [
{'name':'a','age':100},
{'name':'b','age':101},
{'name':'c','age':102},
{'name':'d','age':103},
]
print(max(people,key=lambda dic:dic['age']))
#1.max函数处理的是可迭代对象,相当于一个for循环取出每个元素进行比较,注意,不同类型之间不能进行比较。
#2.每个元素之间进行比较,是从每个元素的第一个位置依次比较,如果这一个位置分出大小,后面的不需要比较了,直接得出这两个元素的大小。
print(chr(97))#
print(ord('a'))#相反
print(pow(10,3,4))#x的y次方对z取余
print(round(4.5))
print(set('hello'))
l = 'hello'
s1 = slice(3,5)
print(l[s1])
people11 = [
{'name':'a','age':100},
{'name':'b','age':101},
{'name':'c','age':102},
{'name':'d','age':103},
]
print(sorted(people11,key=lambda dic:dic['age'],reverse=True))
# Author:FengFeng
#文件处理
# f = open('testNew',encoding='utf8')
# data = f.read()
# print(data)
# print(f.readline())
# f.close()
# f.write('1111\n')
# f.writelines(['111','2222'])
with open('a.txt','w',encoding='utf-8') as f,open('b.txt','w',encoding='utf-8'):
f.write('111\n')