Issue
What is the difference between
("a")
and
("a",)
I noticed that for example mysql wrapper parameters formatting doesn't work with the first case, it must end with comma.
cursorA.execute(query, (url,))
Solution
if you write only one element in parentheses (), the parentheses () are ignored and not considered a tuple.
x = ("a")
print(type(x))
output: str
to generate a one-element tuple, a comma , is needed at the end.
x = ("a", )
print(type(x))
ouput : tuple
Answered By - kiranr Answer Checked By - David Marino (sql.easybugfix Volunteer)
Post a Comment
Post a Comment