- 必须要指定字段名么?不能类似
PHP
那样写了SQL
直接用么
from sqlalchemy import create_engine
eng = create_engine("mysql+pymysql://账号:密码@地址/库") #
with eng.connect() as con: # 连接数据库
result = con.execute("select * from china") # 执行SQL返回结果
for r in result: # 遍历结果
print(r)
上面的代码是百度上的老代码了,新版代码是: