This repository has been archived on 2026-08-27. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
RequestCounter/bin/tests/connectdb.py
T

27 lines
504 B
Python
Raw Normal View History

2022-02-16 16:24:44 +08:00
#!/usr/bin/env python3
# -- coding:utf-8 --
# @Author: markushammered@gmail.com
# @Development Tool: PyCharm
# @Create Time: 2022/2/16
# @File Name: connectdb.py
import sqlite3
def exec(cmd):
try:
conn = sqlite3.connect('../../db/count.db')
cursor = conn.cursor()
cursor.execute(cmd)
return cursor.fetchall()
finally:
cursor.close()
conn.close()
if __name__ == '__main__':
while True:
cmd = input('>>>')
print(exec(cmd))