有人可以向我解释第4行正在做什么?逗号分隔的变量赋值
1 def fib2(n): # return Fibonacci series up to n
2 ... """Return a list containing the Fibonacci series up to n."""
3... result = []
4... a, b = 0, 1 #this line
5... while a < n:
6... result.append(a)
7... a, b = b, a+b
8... return result
第4行基本上是'a = 0'和'b = 1'但是缩短 – MooingRawr
它将0和1分配给'a'和(所以'a'得到0和'b'得到1) – khelwood
https://docs.python.org/3/reference/simple_stmts.html#assignment-statements – wwii