Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3.4
- import PyMySQL
- # Open database connection
- db = PyMySQL.connect("localhost","root","SENHABANCO","BANCODADOS" )
- # prepare a cursor object using cursor() method
- cursor = db.cursor()
- # execute SQL query using execute() method.
- cursor.execute("SELECT VERSION()")
- # Fetch a single row using fetchone() method.
- data = cursor.fetchone()
- print ("Database version : %s " % data)
- # disconnect from server
- db.close()
- #####
- Erro
- Traceback (most recent call last):
- File "testeBanco.py", line 3, in <module>
- import PyMySQL
- ImportError: No module named 'PyMySQL'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement