O.r*_*rka 2 python return function list
my_list = ['a','b','c']
def func(input):
for i in input:
print i
print func(my_list)
Run Code Online (Sandbox Code Playgroud)
产量
a
b
c
None
Run Code Online (Sandbox Code Playgroud)
我不想要'无'所以我怎么能用一行代码来返回输入列表中的项目?
我试过了:
return for i in input: print i
Run Code Online (Sandbox Code Playgroud)
但它没有用,因为return语句不能那样工作
| 归档时间: |
|
| 查看次数: |
3464 次 |
| 最近记录: |