Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. import mysql.connector
  2.  
  3. cnx = mysql.connector.connect(user='ctn17_afrotopia', password='WpTA8hB0w7rKse6P',
  4.                               host='127.0.0.1',
  5.                               database='ctn17_afrotopia')
  6. cursor = cnx.cursor()
  7.  
  8. query = ("SELECT titre, texte, url  FROM indexation")
  9.  
  10. cursor.execute(query)
  11.  
  12. for (titre, texte, url) in cursor:
  13.     print "Titre : ", titre
  14.     print "Texte : ", texte[:30]
  15.     print "Url : ", url
  16. cursor.close()
  17. cnx.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement