Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/335.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 3.0中的SQL?_Python_Sql - Fatal编程技术网

Python 3.0中的SQL?

Python 3.0中的SQL?,python,sql,Python,Sql,如何使用任何SQL数据库,例如mysql、pgsql或其他Python内置支持的数据库 def example(): con= Mysql("root", blablabla) con->query("SELECT * bla bla bla") .... 您使用的数据库和扩展名是什么?对于sqlite3(以及与DB-API 2.0兼容的任何其他扩展),您可以使用以下内容: 顺便说一句,Python中没有->这里有一个与Python 3.x兼容的软件包列表: 我所能找到的只有和

如何使用任何SQL数据库,例如mysql、pgsql或其他Python内置支持的数据库

def example():
  con= Mysql("root", blablabla)
  con->query("SELECT * bla bla bla")
....

您使用的数据库和扩展名是什么?对于
sqlite3
(以及与DB-API 2.0兼容的任何其他扩展),您可以使用以下内容:


顺便说一句,Python中没有
->

这里有一个与Python 3.x兼容的软件包列表:

我所能找到的只有和

conn = sqlite3.connect('/tmp/example')
c = conn.cursor()

# Create table
c.execute('''create table stocks(date text, trans text, symbol text, qty real, price real)''')

# Insert a row of data
c.execute("""insert into stocks values ('2006-01-05','BUY','RHAT',100,35.14)""")

# Save (commit) the changes
conn.commit()

# We can also close the cursor if we are done with it
c.close()