mirror of
https://github.com/WhaleFell/SMSBoom.git
synced 2026-02-10 14:04:57 +08:00
🎈 perf(项目结构): 优化项目结构,数据文件单独放置,依赖文件
优化项目结构,数据文件单独放在一个文件夹里边,使用`pathlib`模块,添加项目所依赖的库。
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
'''
|
||||
Author: whalefall
|
||||
Date: 2021-08-07 21:23:35
|
||||
LastEditTime: 2021-08-09 19:12:32
|
||||
LastEditTime: 2021-08-10 17:10:07
|
||||
Description: 异步轰炸
|
||||
'''
|
||||
import asyncio
|
||||
0
db/data.json
Normal file
0
db/data.json
Normal file
3
requirements.txt
Normal file
3
requirements.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
requests==2.24.0
|
||||
aiohttp==3.7.3
|
||||
pathlib
|
||||
Binary file not shown.
@@ -3,18 +3,21 @@
|
||||
'''
|
||||
Author: whalefall
|
||||
Date: 2021-08-07 14:59:08
|
||||
LastEditTime: 2021-08-07 21:31:13
|
||||
LastEditTime: 2021-08-10 17:08:54
|
||||
Description: python操作数据库
|
||||
'''
|
||||
import sqlite3
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
class Sql(object):
|
||||
def __init__(self) -> None:
|
||||
'''初始化数据库'''
|
||||
# 数据库路径
|
||||
db_path = Path.cwd().joinpath("db", "data.db")
|
||||
# 连接数据库,不检查是否在同一个路径.
|
||||
self.client = sqlite3.connect(
|
||||
"data.db", timeout=6, check_same_thread=False)
|
||||
db_path, timeout=6, check_same_thread=False)
|
||||
self.cursor = self.client.cursor()
|
||||
self.newTable()
|
||||
|
||||
@@ -67,3 +70,4 @@ if __name__ == "__main__":
|
||||
s = Sql()
|
||||
s.update("SWDWQ")
|
||||
print(s.select())
|
||||
# print(Path.cwd().joinpath("db","data.db"))
|
||||
|
||||
Reference in New Issue
Block a user