python3.7 SQLite Tk.listbox

Source: Internet
Author: User
Tags sqlite
Connection Sqlite3
Python software: Https://www.python.org/ftp/python/3.7.0/python-3.7.0.exe

Pytho comes with sqlite3, so only import is required
Simple example:
Import Sqlite3
db = Sqlite3.connect ("./db") #在调用connect函数并指定库名称, if not present, is automatically created by the specified library name.
CU = Db.cursor () #游标
#cu. Execute ("CREATE TABLE LJ (ID integer primary KEY,LJ text not NULL)") #执行sql语句
#cu. Execute ("INSERT into LJ (LJ) VALUES (' C:\python27 ')")
Db.commit () #事务提交
Cu.execute ("select * from LJ;") #查询
Print Cu.fetchall () #打印查询结果, the result is {1 {c:\python27}}
Cu.close () #关闭游标
Db.close () #关闭数据库连接
Official ultra-detailed description: https://docs.python.org/3.7/library/sqlite3.html

python3.7 SQLite Tk.listbox

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.