3

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('ipaddress', _) 

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

0

1 Answer 1

9

No. It is only available within the Python REPL.

Sign up to request clarification or add additional context in comments.

3 Comments

Bummer! I figured, I was just hoping for a clean work around or alternative. Thanks :)
"clean work around"? Isn't that what the assignment statement is?
I have to set a lot of values- I was just hoping to keep each function to a single line- without making it crazy long or to hard to read. I figured out a clear way to write it. Thanks =)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.