Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I didn't mean nested f-strings. I mean this is a syntax error:

    >>> print(f"foo {"bar"}")
    SyntaxError: f-string: expecting '}'
Only this works:

    >>> print(f"foo {'bar'}")
    foo bar


You're using an old Python version. On recent versions, it's perfectly fine:

    Python 3.12.7 (main, Oct  3 2024, 15:15:22) [GCC 14.2.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> print(f"foo {"bar"}")
    foo bar




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: