executemany给出“typeerror:格式字符串参数不足”

t5zmwmid  于 2021-06-21  发布在  Mysql
关注(0)|答案(0)|浏览(198)

我试图在mysql数据库中插入许多行,但由于某些原因,我总是遇到这个错误。我已经尝试了本主题中的解决方案,但没有任何效果。

TypeError: not enough arguments for format string

我的代码:

cursor = db.cursor()

        row = (date, timetoserve, ipcliente, cacheCode, bytesint, method,\
        url.scheme, url.hostname, url.port, url.path, auth, route[0], route[1], contentType)

        items.append(row)

        if Inputs % 100 == 0:
                sql = "INSERT INTO LogTbl \
                (DateConnection, TimeToServe, ClientIP, CacheCode, Bytes, Method,\
                RequestProtocol, RequestIP, RequestPort, RequestFolder, Auth, RouteLeft, RouteRight, ContentType)\
                VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"

            cursor.executemany(sql, items)
            items = []
            db.commit()

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题