1、sqlite3数据库的创建

#!/usr/bin/env python3
# encoding: utf-8

import sqlite3
import os

db_filename = 'todo.db'
db_id_new = not os.path.exists(db_filename)

conn = sqlite3.connect(db_filename)
if db_id_new:
    print('需要创建数据库')
else:
    print('数据库已经存在,')
conn.close()
sqlite3_createdb.py

相关文章:

  • 2021-11-02
  • 2022-12-23
  • 2021-09-19
  • 2022-01-01
  • 2021-06-09
  • 2021-12-14
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-22
  • 2022-12-23
  • 2021-12-06
  • 2021-06-27
  • 2021-06-25
相关资源
相似解决方案