MySQLdb, lots of columns and newb-ness

Andrew Sackville-West andrew at farwestbilliards.com
Wed Dec 20 13:51:49 EST 2006


On Wed, Dec 20, 2006 at 07:00:38AM -0800, Ant wrote:
> 
> 
> On Dec 20, 5:20 am, Andrew Sackville-West <and... at farwestbilliards.com>
> 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'

perfect!

[...]
> 
> 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.

well, no great chance of the data dump changing, but its a good
point. 

thanks
A
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20061220/f993c364/attachment.sig>


More information about the Python-list mailing list