学习中 --建表,添加数据 都过了,
用pycharm也可以查询,操作啊!!如图:

但是用python查询数据表示报错说没有这样的表报错如图:

代码如下:
import sqlite3
conn = sqlite3.connect(r'./mytest.py')
cursor = conn.cursor()
# sql = '''select * from students'''
sql = "select rowid, * from students"
results = cursor.execute(sql)
all_students = results.fetchall()
for student in all_students:
print(student)
行了没问题了 劳烦大家了!!路径问题
conn = sqlite3.connect('D:\pycharm\lesson\sn01\SQL\mytest.db')
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
conn = sqlite3.connect(r'./mytest.py')为啥连接的是py...