Python: try statement single line
Posted
by Brant
on Stack Overflow
See other posts from Stack Overflow
or by Brant
Published on 2010-03-26T16:21:19Z
Indexed on
2010/03/26
16:23 UTC
Read the original article
Hit count: 325
python
Is there a way in python to turn a try/except into a single line?
something like...
b = 'some variable'
a = c | b #try statement goes here
Where b is a declared variable and c is not... so c would throw an error and a would become b...
© Stack Overflow or respective owner