Executemany给出" TypeError:没有足够的参数用于格式字符串"

时间:2018-06-11 14:48:57

标签: python mysql database typeerror executemany

我试图在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()

0 个答案:

没有答案