Python中文
首页
教程
问答
标签
搜索
登录
注册
AttributeError:“module”对象没有属性“connection”
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我的代码开头是:</p> <pre><code>import sqlite3 def construct_query(card_name, card_type,card_type_whole, power, tough, card_text, exp,rare): query = "INSERT INTO CardComponet (all column names) VALUES ('{}','{}',{},{},'{}','{}','{}')".format(card_name, card_type_whole, power, tough, card_text, exp,rare) return query path_to_flat_file = 'C:\Users\Mrs Rose\Desktop\inputf.txt' flat_file_object = open(path_to_flat_file, 'r') connection = sqlite3.connection('practice1.db') cursor = connection.cursor() </code></pre> <p>但我的错误是:</p> ^{pr2}$ <p>我尝试更改我的.py名称和我的数据库名称,但没有任何效果。如果可以,请帮忙。在</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>我看到了几个可能的错误:</p> <ol> <li><p>从文件路径看,我猜你在窗口。好吧,您需要更改文件路径:<code>C:\\Users\\Mrs Rose\\Desktop\\</code>以避免混淆为转义字符。</p></li> <li><p>在我的IDE上,<code>sqlite3</code>模块没有<code>connection</code>方法。。也许{<cd4>}?</p></li> </ol>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
无法使用Django/mongoengine连接到MongoDB(身份验证失败)
9 回答
无法使用Django\u mssql\u后端迁移到外部hos
1 回答
无法使用Django&Python3.4连接到MySql
7 回答
无法使用Django+nginx上载媒体文件
2 回答
无法使用Django1.6导入名称模式
1 回答
无法使用Django1.7和mongodb登录管理站点
2 回答
无法使用Djangoadmin创建项目,进程使用了错误的路径,因为我事先安装了错误的Python
7 回答
无法使用Djangockedi验证CBV中的字段
8 回答
无法使用Djangocketditor上载图像(错误400)
1 回答
无法使用Djangocron进行函数调用
4 回答
无法使用Djangofiler djang上载文件
9 回答
无法使用Djangokronos
5 回答
无法使用Djangomssql provid
3 回答
无法使用Djangomssql连接到带有Django 1.11的MS SQL Server 2016
9 回答
无法使用Djangomssq迁移Django数据库
5 回答
无法使用Djangonox创建用户
2 回答
无法使用Djangopyodb从Django查询SQL Server
4 回答
无法使用Djangopython3ldap连接到ldap
4 回答
无法使用Djangoredis连接到redis
2 回答
无法使用Django中的FK创建新表
10 回答