Advertisement
Guest User

Untitled

a guest
Oct 18th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. import pymysql.cursors  
  2. import random
  3.  
  4.  
  5. # Подключиться к базе данных.
  6. connection = pymysql.connect(host='localhost',
  7.                              user='root',
  8.                              password='power2000',                            
  9.                              db='students',
  10.                              charset='utf8mb4',
  11.                              cursorclass=pymysql.cursors.DictCursor)
  12.  
  13. print ("connect successful!!")
  14.  
  15. try:
  16.  
  17.     with connection.cursor() as cursor:
  18.        
  19.         while True:
  20.                  
  21. finally:
  22.     # Закрыть соединение (Close connection).      
  23.     connection.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement