2013年5月14日 星期二

Python - “_” Argument to functions



In the interactive interpreter _ is used to reference the last returned value


Eg
>>> 2 + 4
6
>>> _ + 4
10
So you can use it as an argument in a function as well
>>> 2 + 4
6
>>> for i in range(_): print(i)
0
1
2
3
4
5




http://stackoverflow.com/questions/10232404/python-argument-to-functions

沒有留言:

張貼留言