About 50 results
Open links in new tab
  1. 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.

  2. Python way of printing: with 'format' or percent form?

    Sep 12, 2012 · Use the format method, especially if you're concerned about Python 3 and the future. From the documentation: The formatting operations described here are modelled on C's printf() …

  3. What does %s mean in a Python format string? - Stack Overflow

    Python supports formatting values into strings. Although this can include very complicated expressions, the most basic usage is to insert values into a string with the %s placeholder.

  4. How do I format a string using a dictionary in python-3.x?

    91 As Python 3.0 and 3.1 are EOL'ed and no one uses them, you can and should use str.format_map(mapping) (Python 3.2+): Similar to str.format(**mapping), except that mapping is …

  5. Python string.format () percentage without rounding

    With Python 3.6+, you can use formatted string literals, also known as f-strings. These are more efficient than str.format. In addition, you can use more efficient floor division instead of math.floor. In my …

  6. python - Format string with custom delimiters - Stack Overflow

    3 Using custom placeholder tokens with python string.format() Context python 2.7 string.format() alternative approach that allows custom placeholder syntax Problem We want to use custom …

  7. datetime - ISO time (ISO 8601) in Python - Stack Overflow

    In Python, I would like to take its creation time, and convert it to an ISO time (ISO 8601) string while preserving the fact that it was created in the Eastern Time Zone (ET). How do I take the file's ctime …

  8. How can I make VS Code format my Python code? - Stack Overflow

    Jun 28, 2023 · How can I make VS Code format my Python code? Asked 2 years, 8 months ago Modified 1 year, 3 months ago Viewed 27k times

  9. python - Convert to binary and keep leading zeros - Stack Overflow

    I'm trying to convert an integer to binary using the bin() function in Python. However, it always removes the leading zeros, which I actually need, such that the result is always 8-bit: Example: ...

  10. How do I make a fixed size formatted string in python?

    I want to create a formatted string with fixed size with fixed position between fields. An example explains better, here there are clearly 3 distinct fields and the string is a fixed size: XXX ...