1. list和tuple的性能
参考文档
https://blog.csdn.net/run_bomb/article/details/91380795
2. dict和set的原理
参考文档
https://blog.csdn.net/siyue0211/article/details/80560783
https://blog.csdn.net/weixin_40107510/article/details/90637640
https://blog.csdn.net/junjunba2689/article/details/82814166
3. 命名元祖
命名元祖:可以想字典一样通过key去取值
from collections import namedtuple
student_dict = namedtuple('student_info', 'name, age, sex')
students = student_dict('张三', '18', 'female')
print(students)
print(students.name)
>
student_info(name='张三', age='18', sex='female')
张三
4. 推导式
# 列表推导式
l = [i for i in range(10)]
# 字典推导式
d = {i: i*2 for i in range(10)}
print(l)
print(d)
>
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
{0: 0, 1: 2, 2: 4, 3: 6, 4: 8, 5: 10, 6: 12, 7: 14, 8: 16, 9: 18}