mysql - execute 是 mysql.connector 的一个属性,但是当我使用它时显示无效
问题描述
import mysql.connector as sql
conn=sql.connect(host='localhost',user='root',password='09062003',database='grocery_shop',charset='utf8')
c=conn.cursor
c.execute('create table if not exists product_details(product_name varchar(25),product_cost float(10))')
print('Product Table Created')
它返回以下错误::
文件“G:\DANGER\InformaticsPractices\IP Project\Grocery Store Management\Grocery Store Management System.py”,第 36 行,在 CreateCust c.execute('create table if not exists customer_details(phone_no int(13),cust_name varchar( 25),cost float(10))') AttributeError: 'function' object has no attribute 'execute'
据我所知,execute 是 mysql.connector 的一个属性
解决方案
推荐阅读
- android - 删除单个 SQlite 行 RecyclerView onSwiped
- javascript - 如何检测 Web Share Target API 的可用性?
- node.js - Bcrypt密码比较不显示结果
- docker - 需要在 docker 容器中使用脚本运行服务
- llvm - 如何关闭llvm中的常量折叠优化
- mysql - 如何在某个时间获取 mysql 日志?
- arrays - 如何将包含游戏板的数组传递给在单独的 .cpp 文件中定义的类函数?
- php - 没有帖子时生成空的li元素
- php - 如何通过要分配的对象转换类型?
- python - 如何有效地检查一个字符串是否包含来自两个列表的至少一个元素