'"""' and linefeed characters

Steve Purcell stephen_purcell at yahoo.com
Sat Jul 15 18:02:06 EDT 2000


Erik Max Francis <max at a...> wrote:
> Matthew Cline wrote:
> > 
> > I'm assuming that returns in a '"""' quoted string are given
> > the linefeed character(s) of the operating system Python is
> > run on.  Is this right?
> 
> They're given a newline ('\n'), which is independent of the
> end-of-line sequence of your operating system.

Ah, so my reply was wrong. Sorry to confuse matters. A quick check
would have been a good idea:-

  [on linux]
  >>> f = open('foo.py','w')
  >>> f.write('"""\r\n"""\r\n')
  >>> f.close()
  >>> import foo
  >>> repr(foo.__doc__)
  "'\\012'"

-Steve

--
Steve Purcell,  Technical Director, Inkontact
Get in touch at http://www.inkontact.com/
Get testing at http://pyunit.sourceforge.net/
"Life must be simple if I can do it" -- Me





More information about the Python-list mailing list