SHARE
TWEET

Untitled

a guest Sep 4th, 2018 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import pymysql.cursors
  2.  
  3. connection = pymysql.connect(host="127.0.0.1", database="addressbook", user="root", password="")
  4.  
  5. #Groups
  6. try:
  7.     cursor = connection.cursor()
  8.     cursor.execute("select * from group_list")
  9.     for row in cursor.fetchall():
  10.         print(row)
  11. finally:
  12.     connection.close()
  13.  
  14. #Contacts
  15. try:
  16.     cursor = connection.cursor()
  17.     cursor.execute("select * from addressbook")
  18.     for rows in cursor.fetchall():
  19.         print(rows)
  20. finally:
  21.     connection.close()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top