Advertisement
Guest User

Untitled

a guest
Sep 4th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  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()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement