Problem Commenting within Filehandle Iteration
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Thu Oct 26 04:18:59 EDT 2006
In <mailman.1248.1161848593.11739.python-list at python.org>, Wijaya Edward
wrote:
> if m:
> print line,
> else:
> #print 'SPAM -- %s' % line
> myfile.close()
>
> […]
>
> Notice that I wanted to comment out the #print line there.
> However I found problem with myfile.close(), with identation error.
> This error doesn't occur when commenting (#) is not in use.
>
> Why so? Is there away to do the commenting in correct way
> under this circumstances?
There has to be code in the ``else`` block. So either comment out the
``else`` line too, or insert a ``pass`` statement.
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list