Create sql lite database, create table, add record to table, read records from table.
Create sql lite database, create table, add record to table, read records from table.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | import sqlite3 con = sqlite3.connect( "dersler.db" ) cursor = con.cursor() def tabloolustur(): cursor.execute( "CREATE TABLE ogrenciler (ad TEXT, soyad TEXT, numara INT, ogrencinotu INT)" ) def degerekle(): cursor.execute( "INSERT INTO ogrenciler VALUES('Onur','ÖZTEN ÜĞİŞÖ',789512,76)" ) con.commit() def degerlerial(): "" " değerleri alır " "" cursor.execute( "select * from ogrenciler" ) data = cursor.fetchall() for i in data: print(i) tabloolustur() degerekle() degerlerial() con.close() |