Reputation: 1006
I am executing a select query from python program to MySQL 5.2.39 database. But the result from mysql editor select query and python program select query is slightly different. Database name is world, table name is wordcount, it has 4 column: id, author, word,count. why those L suffix coming in python result ? can anybody tell what could be the reason ? even I have tried to put the whole long select query expression in single line in my python code but still same problem. I am using Eclipse with Pydev. Below is my python code :
import MySQLdb as mdb
import sys
con = mdb.connect('localhost', 'root', '1234', 'world')
con.autocommit(True)
with con:
cur = con.cursor()
cur.execute("select author,count(distinct word),count(distinct id) from \
world.wordcount \
group by author \
having count(distinct word)<> count(distinct id) \
order by author")
rows = cur.fetchall()
for row in rows:
print row
sample result from python :
('A GONZ LEZ', 18L, 19L)
('A M MORENO', 8L, 9L)
sample result from MySQL editor :
A GONZ LEZ|18|19
A M MORENO| 8| 9
Upvotes: 0
Views: 230
Reputation: 82088
They're the same values, even if the representation is different. When L
is after a number in Python < 3, that means the number is a long
, which is a specific type of number.
Upvotes: 1