Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在QR代码中存储SQLite表的行数据_Python_Sqlite_Qr Code - Fatal编程技术网

Python 在QR代码中存储SQLite表的行数据

Python 在QR代码中存储SQLite表的行数据,python,sqlite,qr-code,Python,Sqlite,Qr Code,我正在为我的颜色检测应用程序生成二维码 def qr_yellow(sl): "Select * from ColorDetector where sl = {}".format(sl) qr_y = str(c.fetchall()) url = pyqrcode.create(qr_y) url.svg("CodeYellow{}.svg".format(sl), scale=8) 我正在使用 c.execute("SELECT * from ColorDe

我正在为我的颜色检测应用程序生成二维码

def qr_yellow(sl):
    "Select * from ColorDetector where sl = {}".format(sl)
    qr_y = str(c.fetchall())
    url = pyqrcode.create(qr_y)
    url.svg("CodeYellow{}.svg".format(sl), scale=8)
我正在使用

c.execute("SELECT * from ColorDetector where sl =1")
并将其转换为字符串。生成的二维码可以毫无问题地存储提取的数据。但是当我扫描代码时,数据没有被提取出来。它只显示
[]


这是我存储在QR中的数据:
[(1,'YELLOW',2019-12-30 17:42:42.971372')]

首先需要获取数据并将其转换为字符串,然后将其传递给create函数


此外,在从数据库提取数据时,您应该始终指定字段,而不是执行select*

将提取的数据转换为字符串并存储在创建的二维码中,但当我扫描它时,数据不仅显示为[]。正如您所说,如果您改进了代码并更接近,请更新您的问题,以便人们能够更好地帮助您。非常感谢。