A C-like if statement
Bob Greschke
bob at passcal.nmt.edu
Thu Feb 23 13:40:19 EST 2006
I miss being able to do something like this in Python
1f (I = a.find("3")) != -1:
print "It's here: ", I
else:
print "No 3's here"
where I gets assigned the index returned by find() AND the if statement gets
to do its job in the same line. Then you don't have to have another like
that specifically gets the index of the "3". Is there a way to do this in
Python?
Thanks!
Bob
More information about the Python-list
mailing list