On Thu, 22 Oct 2020 at 12:36, Hans Ginzel <h...@matfyz.cz> wrote:

> On Thu, Oct 22, 2020 at 08:31:34PM +1100, Steven D'Aprano wrote:
> >> cursor.execute(f"INSERT INTO {table} VALUES (1, '{}');")
> >> SyntaxError: f-string: empty expression not allowed
> >
> >Escape the braces by doubling them:
> >    f"INSERT INTO {table} VALUES (1, '{{}}');"
>
> Thank you for (ugly) workaorund.
>

It's not ugly for me too, but if you want another workaround:

d = {}
f"INSERT INTO {table} VALUES (1, '{d}');"
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/F63STJCC3MFLMYSS7KTKSRO3VGZOP27V/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to