Are newlines sometimes required at end of Python code?

Edward C. Jones edcjones at erols.com
Fri Mar 31 15:08:57 EST 2000


Why does this piece of code work:

s~=~"""for~i~in~range(3):\n~~~~x~=~i\n"""
exec~s

while this one doesn't:

s~=~"""for~i~in~range(3):\n~~~~x~=~i"""
exec~s

I have replaced all the spaces in the code by "~".





More information about the Python-list mailing list