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
从数据库检索url并使用webbrowser()打开时出现Python错误_Python_Sqlite_Web - Fatal编程技术网

从数据库检索url并使用webbrowser()打开时出现Python错误

从数据库检索url并使用webbrowser()打开时出现Python错误,python,sqlite,web,Python,Sqlite,Web,我正在尝试制作一个类似StumbleUpon的应用程序,使用Python作为个人项目的后端。从数据库中检索网站名称,然后使用webbrowser.open(“http://www.website.com"). 听起来很直截了当,但有个问题。当我尝试使用webbrowser.open(“website.com”)打开网站时,它返回以下错误: File "fetchall.py", line 18, in <module> webbrowser.open(x) File "/usr/li

我正在尝试制作一个类似StumbleUpon的应用程序,使用Python作为个人项目的后端。从数据库中检索网站名称,然后使用webbrowser.open(“http://www.website.com"). 听起来很直截了当,但有个问题。当我尝试使用webbrowser.open(“website.com”)打开网站时,它返回以下错误:

File "fetchall.py", line 18, in <module>
webbrowser.open(x)
File "/usr/lib/python2.6/webbrowser.py", line 61, in open
if browser.open(url, new, autoraise):
File "/usr/lib/python2.6/webbrowser.py", line 190, in open
for arg in self.args]
TypeError: expected a character buffer object
编辑

好的,谢谢你的回复,但是现在我收到了这样一封邮件:“错误显示URL:Error stating file'/home/user/(u'http:bbc.co.uk,)':没有这样的文件或目录”


发生了什么事?

webbrowser.open
需要一个字符缓冲区,但
fetchmany
返回一个列表。所以
webbrowser.open(x[0])
应该可以做到这一点。

现在可以打印x并用它更新帖子了吗?
import sqlite3
import webbrowser 

conn = sqlite3.connect("websites.sqlite")

cur = conn.cursor()

cur.execute("SELECT WEBSITE FROM COLUMN")

x = cur.fetchmany(1)

webbrowser.open(x)