Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!python
- #-*-coding:utf-8-*-
- import pymysql.cursors
- def main():
- con = pymysql.connect(
- host = '127.0.0.1',
- user = 'root',
- password = 'mysql',
- db = 'test'
- )
- with con.cursor() as cur:
- cur.execute("select * from user")
- print(cur.fetchone())
- con.close()
- print('con closed')
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement