forked from hussien89aa/PythonTutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.py
More file actions
23 lines (14 loc) · 624 Bytes
/
database.py
File metadata and controls
23 lines (14 loc) · 624 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import sqlite3
def main():
db=sqlite3.connect("information.db")
db.row_factory=sqlite3.Row
db.execute("create table if not exists Admin(Name text,age int)")
db.execute("insert into Admin (Name,age) values (? , ?)",("Hussein",26))
db.execute("insert into Admin (Name,age) values (? , ?)",("Jena",1))
db.commit()
#db.execute("delete from Admin where name='Jena'")
#db.execute("Update Admin set age=2 where name='Jena'")
cusror=db.execute("select * from Admin")
for row in cusror:
print("Name:{}, Age:{}".format(row["Name"],row["age"]))
if __name__ == '__main__':main()