DenisMagic

Untitled

Jun 24th, 2021
924
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import sqlite3
  2.  
  3. conn = sqlite3.connect('sql.db')
  4. cursor = conn.cursor()
  5. cursor.execute("""CREATE TABLE users (id int, name varchar(30), sorname varchar(30), adress varchar(100));""")
  6. conn.commit()
  7. results = cursor.fetchall()
  8. results2 = cursor.description
  9. print(results)
  10. print(results2)
  11. input("db создана. Жми Enter")
  12. cursor.execute("""INSERT INTO users (id, name, sorname, adress) VALUES ('1', 'Test', 'TestSorname', 'Test adress');""")
  13. conn.commit()
  14. results1 = cursor.fetchall()
  15. print(results1)
  16. input("table заполнен. Жми Enter")
  17. cursor.execute("""SELECT * FROM users""")
  18. conn.commit()
  19. results5 = cursor.fetchall()
  20. desc1 = cursor.description
  21. print(results1)
  22. print(desc1)
  23. input("Всё прошло на ура")
  24. conn.close()
RAW Paste Data