Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pymysql.cursors
- connection = pymysql.connect(host='localhost',
- user='bauhau93',
- password='hallo123',
- db='mr.tester',
- charset='utf8mb4',
- cursorclass=pymysql.cursors.DictCursor)
- print('CONNECTION SUCCESSFULL!')
- try:
- with connection.cursor() as cursor:
- sql ="select * from telefonbuch"
- cursor.execute(sql)
- print("cursor.description:", cursor.description)
- print()
- for row in cursor:
- print(row)
- except:
- print("Abrafge war kacke")
- finally:
- connection.close()
Add Comment
Please, Sign In to add comment