Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
92 views
in Technique[技术] by (71.8m points)

python 3.x - Executing requests double quote

I tried to enter values in a database automatically.

for each table, I list the number of columns that are contained in an xml file, then I'm going to fetch the data in a pandas dataframe

            column = ""
            values = []
            for i, tables in enumerate(bddXml):
                for test in range(len(tables[1])):
                    column += (tables[1][test][0])
                    values.append(tables[1][test][1])


                table = Identifier(str(tables[0]))
                column = Identifier(str(column))
                value = Identifier(str(a[values].to_string(index=False, header=False)).strip())


                cur.execute(SQL("""INSERT INTO {table}({column}) VALUES({value});""").format(table=table,column=column, value=value))

                column = []
                values = []

when I test my code, it returns this error to me

INSERT INTO "users"("login") VALUES("...")

the problem is due to the ", there should normally be single quote

question from:https://stackoverflow.com/questions/65902870/executing-requests-double-quote

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...