Michael Sperlle wrote: > 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.
Failed in what strange way? I don't see a problem at all: >>> open("bla.txt",'w').write("# some line with a hash comment\n") >>> open("bla.txt").read() '# some line with a hash comment\n' --Irmen -- http://mail.python.org/mailman/listinfo/python-list