Guest User

Untitled

a guest
Aug 8th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. import pymysql
  2. connection = pymysql.connect(host='localhost',
  3. user='usuario',
  4. password='contraseña',
  5. db='base_de_datos',
  6. charset='utf8mb4',
  7. cursorclass=pymysql.cursors.DictCursor)
  8. cursor = connection.cursor()
  9. sql = "SELECT * FROM tabla"
  10. cursor.execute(sql)
  11. result = cursor.fetchone()
  12.  
  13. connection.close()
Add Comment
Please, Sign In to add comment