L postfix char on longs - what is the best way to discard it.?

Stefan Franke spamfranke at bigfoot.de
Mon Aug 16 09:02:07 EDT 1999


On Fri, 13 Aug 1999 13:22:22 +0100, "Jim Crumpler" <Jim.Crumpler at unicity.com.au> wrote:

>Hi folks - I'm batting to find a nice clean way to remove the 'L' from long
>repr strings .. (eg, my SQL queries end up like "SELECT * FROM blah WHERE
>guff = 23423L"..)
>
>I can fiddle with every bit of my code that attempts to display a long, such
>as
>
>query = "... WHERE guff = %s" % repr(long(x))[0:-1]
>
> -- its ugly when you use alot of longs, but does the job..
>
[snip]
>
>Does anyone have some suggestions on better methods?

Printing a long without the L-suffix would be a good candidate for an 
additional format specifier of the %-Operator IHMO.

Stefan





More information about the Python-list mailing list