Advertisement
zurix

bdd_python

Jan 30th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. #coding:utf-8
  2.  
  3. import pymysql
  4.  
  5. conn = pymysql.connect(host='localhost',user='axel',password='***',db='rpi_arduino')
  6.  
  7. cursor = conn.cursor()
  8.  
  9. sql = 'SELECT etat from `comm_1`;'
  10. cursor.execute(sql)
  11.  
  12. countrow = cursor.execute(sql)
  13. print('nombre de lignes: ',countrow)
  14. data = cursor.fetchall()
  15. data_str = str(data)
  16. print(data_str.replace("), ","), \n"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement