pyhton内置函数
内置函数 |
所有内置函数的地址:https://docs.python.org/3.5/library/functions.html#func-dict
1、type(变量名)-> class 查看变量的数据类型
2、print(self, *args, sep=' ', end='\n', file=None)
sep:指定多个参数以什么隔开
end:指定以什么结尾
print('hello', 'word', sep='&', end='***********') # hello&word***********
3、sorted() -> list 根据指定的key进行排序,默认升序,并返回一个list
students = [
{'name': 'zhangsan', 'age': 18, 'score': 92},
{'name': 'lisi', 'age': 20, 'score': 90},
{'name': 'wangwu', 'age': 19, 'score': 95},
{'name': 'jerry', 'age': 21, 'score': 98},
{'name': 'chris', 'age': 17, 'score': 100},
]
s = sorted(students,key=lambda x:x['age'],reverse=True)
print(s)