简体   繁体   English

数据库行列选择问题<sqlite3.Row object at 0x000001DE5B746D50>得到这个奇怪的回报

[英]Problem with database row and column selection <sqlite3.Row object at 0x000001DE5B746D50> getting this wierd return

hii when i was trying to do a project on database management using sqlite i face this problem.您好,当我尝试使用 sqlite 进行数据库管理项目时,我遇到了这个问题。 the code is代码是

import sqlite3
class DBConnect():
    def __init__(self):
        self.db=sqlite3.connect("Registrations.db")
        self.db.row_factory=sqlite3.Row
        self.db.execute("create table if not exists Ticket(ID integer Primary key autoincrement,name text,gender text,comment text)")
        self.db.commit()
    def Add(self,Name,gender,comment):
        self.db.row_factory=sqlite3.Row
        self.db.execute("insert into Ticket(name,gender,comment) values(?,?,?)",(Name,gender,comment))
        self.db.commit()
        return "DATA ADDED SUCCESFULLY"
    def Show(self):
        self.db.row_factory = sqlite3.Row
        cursor=self.db.execute("select * from Ticket").fetchall()
        print(type(cursor))
        return cursor

Iam not getting any row data instead i get the address where it is stored like this <sqlite3.Row object at 0x000001DE5B746D50>我没有得到任何行数据,而是得到了它存储的地址,就像这个 <sqlite3.Row object at 0x000001DE5B746D50>

I think you are trying to print the contents of the row ie Name Gender etc but instead ended up printing the type of the object print(type(cursor)) which is <sqlite3.Row object at 0x000001DE5B746D50> .我认为您正在尝试打印行的内容,即Name Gender etc但最终打印了对象的类型print(type(cursor))这是<sqlite3.Row object at 0x000001DE5B746D50>

To print the contents of the row you can try print(cursor)要打印行的内容,您可以尝试print(cursor)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 <sqlite3.Row object at >在数据库外键中 - <sqlite3.Row object at > in database foreign key <sqlite3.Row对象位于0x1017fe3f0>而不是数据库内容 - <sqlite3.Row object at 0x1017fe3f0> instead of database contents TypeError: int() 参数必须是字符串,类似字节的 object 或实数,而不是 'sqlite3.Row' - TypeError: int() argument must be a string, a bytes-like object or a real number, not 'sqlite3.Row' 使用sqlite3.Row按名称索引结果的行为不一致 - Inconsistent behaviour using sqlite3.Row to index into results by name python / sqlite3:sqlite3无法正确处理具有相同名称的多个列 - python/sqlite3: multiple columns with the same name not correctly treated by sqlite3.Row Pandas:如果 A 列中的行包含“x”,则将“y”写入 B 列中的行 - Pandas: if row in column A contains "x", write "y" to row in column B Bokeh DataTable - 在选择回调时返回行和列 - Bokeh DataTable - Return row and column on selection callback 执行删除操作后的列表为:<filter object at 0x000001d5a0952fa0> python 中的错误</filter> - The list after performing remove operation is : <filter object at 0x000001D5A0952FA0> error in python 为什么我得到这个?? <generator object <genexpr>在 0x000001C468108DC8></generator> - why am i getting this?? <generator object <genexpr> at 0x000001C468108DC8> 熊猫:如果A列中的行包含字符串“ x”,“ y”,“ z”,请在B列中写“ x _”,“ y _”,“ z_” - Pandas: if row in column A contains strings “x”,“y”,“z”, write “ “x_”,“y_”,“z_” to row in column B
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM