Advertisement
Guest User

Untitled

a guest
Sep 4th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 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. try:
  6. cursor = connection.cursor()
  7. cursor.execute("select * from group_list")
  8. for row in cursor.fetchall():
  9. print(row)
  10. finally:
  11. connection.close()
  12.  
  13. try:
  14. cursor = connection.cursor()
  15. cursor.execute("select * from addressbook")
  16. for rows in cursor.fetchall():
  17. print(rows)
  18. finally:
  19. connection.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement