How do I handle #

Michael Sperlle sperlle at
Sat Mar 25 01:46:24 CET 2006

I need to write out a file containing the # comment. When I try to specify
it as part of a literal, everything afterward turns into a comment.

I finally created a file containing the #, read it in, and used the
resulting variable as part of the string I created.

But that is so kludgy, even a newbie like me is ashamed to use it, though
I did.

Supposedly, I can us \x followed by the hex equivalent and somehow make
that work.

Can anybody give an example of this; my attempts failed.

Or is there something simpler? There must be.

More information about the Python-list mailing list