MySQLdb integer question
Polerio Babao Jr.II
admin at polerio.com
Thu Oct 16 04:20:38 EDT 2003
Ansgar Wollnik <wiseworld at web.de> wrote in message news:<bmkghg$nfpua$1 at ID-176487.news.uni-berlin.de>...
> Hello,
>
> I use Python with MySQLdb to transfer data from one database to another.
> When I SELECT the data from the first table, numbers are provided with
> an 'L' at the end to show, they are treated as a Long Integer (see:
> http://www.esrf.fr/computing/bliss/python2/MySQL/MySQLdb-3.html#ss3.4).
>
> Now I want to put that data into the new database but the 'L's are still
> there. What can I do?
>
> Ansgar
in order to convert it, you should use the python built-in function, int()
int() - this will convert a number with L into an interger, i.e.
>>>a = 200L
>>>a = int(a)
>>>print a
200
example taken from a tuple
>>>c = ('a',200L)
>>>print int(c[1])
200
mabuhay!
More information about the Python-list
mailing list