Advertisement
Guest User

Untitled

a guest
Mar 14th, 2017
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #!python
  2. #-*-coding:utf-8-*-
  3. import pymysql.cursors
  4.  
  5. def main():
  6. con = pymysql.connect(
  7. host = '127.0.0.1',
  8. user = 'root',
  9. password = 'mysql',
  10. db = 'test'
  11. )
  12.  
  13. with con.cursor() as cur:
  14. cur.execute("select * from user")
  15. print(cur.fetchone())
  16.  
  17. con.close()
  18.  
  19. print('con closed')
  20.  
  21. if __name__ == '__main__':
  22. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement