Skip to content

Instantly share code, notes, and snippets.

@hdknr
Created September 9, 2009 06:52
Show Gist options
  • Save hdknr/183526 to your computer and use it in GitHub Desktop.
Save hdknr/183526 to your computer and use it in GitHub Desktop.
>>> type(con)
<class 'MySQLdb.connections.Connection'>
>>> c=con.cursor()
>>> c
<MySQLdb.cursors.Cursor object at 0xa1a2c6c>
>>> c.execute('show tables',None)
19L
(('auth_group',), ('auth_group_permissions',),....
>>> c.execute('select username from auth_user where username like %s',('hdknr'))
1L
>>> c.fetchall()
(('hdknr',),)
>>> c.execute('select username from auth_user where username like %s',('hoge'))
0L
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment