各位大大好 小弟非本科系生 目前自學Python3
程式碼如下:(Python3.6)
import sqlite3
with sqlite3.connect('c.sqlite') as db:
c.to_sql('c',con=db,self.if_exists='append')
(c這資料是用pandas將台銀牌告匯率爬取下來,參考如下網址:
https://www.youtube.com/watch?v=-c5rrzjsN34)
錯誤:
File "<ipython-input-56-246156207101>", line 3
c.to_sql('c',con=db,self.if_exists='append')
^
SyntaxError: keyword can't be an expression
題目只是單純將c這資料存在資料庫中
另若是把self.拿掉
則出現以下錯誤:
OperationalError Traceback (most recent call last)
<ipython-input-57-e5a3883ff452> in <module>()
1 import sqlite3
2 with sqlite3.connect('c.sqlite') as db: