1.使用pymysql連結資料庫時報了錯誤
錯誤代碼:
<code>SyntaxError: unexpected EOF while parsing Process finished with exit code 1 </code>
2.下面是我的程式碼
<code>import pymysql ## 链接数据库 connection = pymysql.connect(host = 'localhost',user = 'root',passwd = 'gangan',db = 'qiandao') try: cur = connection.cursor() cur.execute("SELECT fk_si_user,si_trueName from fbl_stuinfo where si_trueName like '甘%'") data = cur.fetchall() for row in data: print('%s\n%s'%row) cur.close() connection.commit() </code>
3.EOF錯誤是什麼意思呢,一般的解決思路是什麼? python 3.5 新人求教
1.使用pymysql連結資料庫時報了錯誤
錯誤代碼:
<code>SyntaxError: unexpected EOF while parsing Process finished with exit code 1 </code>
2.下面是我的程式碼
<code>import pymysql ## 链接数据库 connection = pymysql.connect(host = 'localhost',user = 'root',passwd = 'gangan',db = 'qiandao') try: cur = connection.cursor() cur.execute("SELECT fk_si_user,si_trueName from fbl_stuinfo where si_trueName like '甘%'") data = cur.fetchall() for row in data: print('%s\n%s'%row) cur.close() connection.commit() </code>
3.EOF錯誤是什麼意思呢,一般的解決思路是什麼? python 3.5 新人求教
你應該把全部錯誤貼上來,報這個錯誤並不一定是因為連mysql經起,極有可能是你print的問題
print(r'%sn%s'%row)前面加個r試試