About 227,000 results
Open links in new tab
  1. What does 'f' mean before a string in Python? - Stack Overflow

    Oct 4, 2019 · This is called f-strings and are quite straightforward : when using an "f" in front of a string, all the variables inside curly brackets are read and replaced by their value.

  2. python - What is print (f"...") - Stack Overflow

    Jul 22, 2019 · 148 The f means Formatted string literals and it's new in Python 3.6. A formatted string literal or f-string is a string literal that is prefixed with f or F. These strings may contain replacement …

  3. python - What are use cases for nested f-strings - Stack Overflow

    Although certainly not the motivation for allowing nested f-strings, nesting may be helpful in obscure cases where you need or want a "one-liner" (e.g. lambda expressions, comprehensions, python -c …

  4. python - Fixed digits after decimal with f-strings - Stack Overflow

    Is there an easy way with Python f-strings to fix the number of digits after the decimal point? (Specifically f-strings, not other string formatting options like .format or %) For example, let's s...

  5. python - String formatting: % vs. .format vs. f-string literal - Stack ...

    To answer your second question, string formatting happens at the same time as any other operation - when the string formatting expression is evaluated. And Python, not being a lazy language, …

  6. python - Combine f-string and raw string literal - Stack Overflow

    I'm wondering how to use an f-string whilst using r to get a raw string literal. I currently have it as below but would like the option of allowing any name to replace Alex I was thinking adding an f-string and …

  7. python - f-strings giving SyntaxError? - Stack Overflow

    For a general overview of the f-string feature, see String with 'f' prefix in python-3.6. For details on alternate approaches to string formatting, see How do I put a variable’s value inside a string …

  8. How can I use newline '\n' in an f-string to format a list of strings?

    Jun 27, 2017 · The other answers give ideas for how to put the newline character into a f-string field. However, I would argue that for the example the OP gave (which may or may not be indicative of …

  9. python - f-strings vs str.format () - Stack Overflow

    111 I'm using the .format() a lot in my Python 3.5 projects, but I'm afraid that it will be deprecated during the next Python versions because of f-strings, the new kind of string literal.

  10. python - How to escape curly-brackets in f-strings? - Stack Overflow

    How to escape curly-brackets in f-strings? [duplicate] Asked 8 years, 9 months ago Modified 11 months ago Viewed 289k times