On Dec 20, 5:20 am, Andrew Sackville-West <[EMAIL PROTECTED]>
wrote:
> > >>> values = ", ".join([escapeAndQuote(f[:-2]) for f in fields])

Obviously this is the appropriate choice since this is a database app.
In general the strip() group of string methods do what you want in a
safe way - assuming you don't care about whitespace:

>>> s = "   test   \r\n"
>>> s.strip()
'test'
>>> s.rstrip()
'   test'
>>> s.lstrip()
'test   \r\n'

If you are concerned about whitespace:
>>> s.strip("\n\r")
'   test   '

strips any \n's or \r's from the ends of the line.

This way it doesn't matter what your line endings are -  you won't be
surprised by missing characters if the data dump changes for any
reason.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to