About 335,000 results
Open links in new tab
  1. String formatting in Python - Stack Overflow

    I want to do something like String.Format("[{0}, {1}, {2}]", 1, 2, 3) which returns: [1, 2, 3] How do I do this in Python?

  2. How to include the symbol " {" in a Python format string?

    Mar 22, 2013 · Format strings contain “replacement fields” surrounded by curly braces {}. Anything that is not contained in braces is considered literal text, which is copied unchanged to …

  3. How to print a number using commas as thousands separators

    How do I print an integer with commas as thousands separators? 1234567 1,234,567 It does not need to be locale-specific to decide between periods and commas.

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

    For reference: Python 3 documentation for the newer format() formatting style and the older % -based formatting style.

  5. Using variables in the format() function in Python

    Sep 5, 2015 · The advantage of using a regular string template and str.format() is that you can swap out the template, the advantage of f-strings is that makes for very readable and compact …

  6. Using multiple arguments for string formatting in Python (e.g., '%s ...

    Aug 3, 2010 · This method of string formatting is the new standard in Python 3.0, and should be preferred to the % formatting described in String Formatting Operations in new code.

  7. Format numbers to strings in Python - Stack Overflow

    2 You can use the str.format () to make Python recognize any objects to strings.

  8. python - How to print formatted string in Python3? - Stack Overflow

    Nov 11, 2014 · How to print formatted string in Python3? Asked 10 years, 7 months ago Modified 5 years, 7 months ago Viewed 121k times

  9. python - String formatting named parameters? - Stack Overflow

    In fact, instead of my_url, you can write an arbitrary Python expression, as long as it evaluates to a string (because of the :s formatting code). If you want a string representation for the result of …

  10. python - Display a decimal in scientific notation - Stack Overflow

    Aug 2, 2011 · 12 See tables from Python string formatting to select the proper format layout. In your case it's %.2E.

Refresh