Section 34.1: 函数和调用

作为参数的列表只是另一个变量:

def func(myList):
  for item in myList:
    print(item)

并可在函数调用本身中传递:

func([1,2,3,5,7])

1
2
3
5
7

函数和调用

或作为变量:

aList = ['a','b','c','d']
func(aList)

a
b
c
d

函数和调用