Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pymysql
- # Connect to the database
- connection = pymysql.connect(host='localhost',
- user='root',
- password='',
- db='dbupm',
- charset='utf8mb4',
- cursorclass=pymysql.cursors.DictCursor)
- try:
- with connection.cursor() as cursor:
- # Read a single record
- sql = "SELECT * From usermaster"
- cursor.execute(sql)
- result = cursor.fetchone()
- print(result)
- finally:
- connection.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement