[问题] SQLite3 将资料存在数据库中

楼主: xy210742 (Sam)   2018-07-14 19:25:16
各位大大好 小弟非本科系生 目前自学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:
作者: Raymond0710 (雷门)   2018-07-14 19:35:00
不用self吧
作者: kenduest (小州)   2018-07-15 06:44:00
怎么感觉看到 pandas 语法,是不是整个搞错了你的程式码也不完整,建议整个张贴好确认

Links booklink

Contact Us: admin [ a t ] ucptt.com