有人可以向我解釋第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