Python Code
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#-*-coding:utf-8-*- #!/usr/bin/python #filename:creat_db.py #codedtime:2014-8-2622:33:58 importsqlite3 #警告:todo.db文件被创建到当前目录下 con=sqlite3.connect( 'todo.db') con.execute( "CREATETABLEtodo(idINTEGERPRIMARYKEY,taskchar(100)NOTNULL,statusboolNOTNULL)") con.execute( "INSERTINTOtodo(task,status)VALUES\ ( 'ReadA-byte-of-pythontogetagoodintroductionintoPython',0) ") con.execute( "INSERTINTOtodo(task,status)VALUES\ ( 'VisitthePythonwebsite',1) ") con.execute( "INSERTINTOtodo(task,status)VALUES\ ( 'TestvarIoUseditorsforandchecktheSyntaxhighlighting',status)VALUES\ ( 'ChooseyourfavoriteWSGI-Framework',0) ") con.commit() |