【发布时间】:2021-03-05 19:18:54
【问题描述】:
我在 Python 中使用 sqlite3。
我的桌子:
cursor.execute("""create table student(rno int, name char(20), grade char, gender char, avg decimal(5,2), dob date);""")
其中 cursor 是我的光标对象的名称 ...
我使用 cursor.description 来显示列名。但是每个元组中有七个字符串,其中六个是 None
print(cursor.description)
Output : (('rno', None, None, None, None, None, None), ('name', None, None, None, None, None, None), ('grade', None, None, None, None, None, None), ('gender', None, None, None, None, None, None), ('avg', None, None, None, None, None, None), ('dob', None, None, None, None, None, None))
从API 可以看出,每个元组的前两个元素是必须的。但这不适合我。为什么?
我还应该在我的表中进行哪些更改以获取设置为无的其他元素的值???
感谢任何相关的帮助....
【问题讨论】:
-
这 7 项中的哪一项对您很重要?您需要的不仅仅是列名和数据类型吗?