列表推导式是 Python 中一种简洁的创建列表的方法。它可以让你用一行代码创建复杂的列表。
[expression for item in iterable if condition]
# 创建平方数列表 squares = [x**2 for x in range(10)]