On Thu, Oct 22, 2020 at 7:39 AM Hans Ginzel <[email protected]> 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 is no different than having to write \\ in a string to get a single backslash : it is part of the syntax of f-strings, and not a "workaround".
André Roberge > > > > > -- > BR, H. > _______________________________________________ > Python-ideas mailing list -- [email protected] > To unsubscribe send an email to [email protected] > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/[email protected]/message/2B5KEM34SUO3TXDMMZE6A332L3SKVLEF/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/67JTOL2MGRQB2CAAFG4HJXV7XDJXNT4Y/ Code of Conduct: http://python.org/psf/codeofconduct/
