开发者

Python underscore variable

开发者 https://www.devze.com 2023-03-05 13:29 出处:网络
In interactive python, there is the \'continuation variable\', the underscore. >>> import netlib

In interactive python, there is the 'continuation variable', the underscore.

>>> import netlib
>>> netdev = netlib.netface('eth1')
>>> if netdev.getIP():
...    print _
... 
10.80.22.100
>>>

But using this in a script, it is undefined so this fails:

if netdev.getIP(): SetValue('ipaddre开发者_如何转开发ss', _)

Is there something similar or a way to enable this for scripts?


No. It is only available within the Python REPL.

0

精彩评论

暂无评论...
验证码 换一张
取 消