84669 Lernen von Personen
152542 Lernen von Personen
20005 Lernen von Personen
5487 Lernen von Personen
7821 Lernen von Personen
359900 Lernen von Personen
3350 Lernen von Personen
180660 Lernen von Personen
48569 Lernen von Personen
18603 Lernen von Personen
40936 Lernen von Personen
1549 Lernen von Personen
1183 Lernen von Personen
32909 Lernen von Personen
cursor.execute("SELECT article_num1,article_num2,citation_num1,citation_num2,shortest_path_length FROM colla WHERE colla.author_name1 = '%s'",name)
结果为None
但是在数据库的命令行里运行就有结果,这是什么原因?
认证高级PHP讲师
cursor.execute("SELECT article_num1,article_num2,citation_num1,citation_num2,shortest_path_length FROM colla WHERE colla.author_name1 = %s",(name,))
这个是最找到的答案。我得到了正确结果。提醒一下,我是用的python3.4
你是怎样获取结果的,cursor.fetchone()
cursor.fetchone()
execute的参数错了,第二个参数必须是一个sequence或者是dict,可以改成下面这样。
cursor.execute("SELECT article_num1,article_num2,citation_num1,citation_num2,shortest_path_length FROM colla WHERE colla.author_name1 = '%s'",(name,))
这个是最找到的答案。我得到了正确结果。
提醒一下,我是用的python3.4
你是怎样获取结果的,
cursor.fetchone()
execute的参数错了,第二个参数必须是一个sequence或者是dict,可以改成下面这样。