Jaime Wyant wrote:
[snip]
After goofing around with this idea, I've realized you can't be very
expressive with a bunch of python statements strung together. My
biggest problem is that I can't figure out (i don't think you can),
how to do conditionals that are strung together:
# This won't work
if a > 5: print "a > 5";else print "Doh"
I've decided to just call a function from the semicolon delimited
record, using the return value in my `C' app...
The following might work based on the context:
code = '''if a > 5: \n print "a > 5"\nelse:\n print "Doh"\n'''
or, formatted differently
code = '''
if a > 5:
print "a > 5"
else:
print "Doh"
'''
Then, you could do
exec(code)
Yeah, I tried to "make it work", but it just won't. At least not in a
satisfactory way.
Thanks!
jw
Andr�
--
http://mail.python.org/mailman/listinfo/python-list