import sqlite3 as sq3
class DataModule:
def del_tbl(tbl_Name):
sq3.Connection("csm").cursor().execute("DROP TABLE IF EXSISTS '{}'".format(tbl_Name))
print("Table [{}] has beeen deleted".format(tbl))
def createTable(tableName,cmd):
del_tbl("tbl_login")
del_tbl("tbl_address")
cmd=str.join(", ",cmd)
sq3.Connection("csm").cursor().execute("CREATE TABLE IF NOT EXISTS {} ({}); ".format(tableName, cmd))
输出现在说:
Error: ("name 'del_tbl' is not defined",)
Error: ("name 'del_tbl' is not defined",)
Press any key to continue . . .
我肯定我错过了一些很简单的东西
1条答案
按热度按时间p5fdfcr11#
这不是一个函数,而是一个类方法,你必须用self调用它。prefix(并将其添加到方法定义中):