【发布时间】:2017-04-11 22:30:51
【问题描述】:
我在 Python 脚本中使用 Mysql Connection。
如何按名称从表中获取结果?
cursor = conn.cursor()
cursor.execute("SELECT * FROM local")
现在我按索引来做:
results = cursor.fetchall()
for row in results:
print row[0] //
我想通过以下名称获取字段:print row["name"]
【问题讨论】:
-
我没有找到解决方案
标签: python mysql python-3.x