Python f-string format guesser

Copied to clipboard.

Paste a formatted number or date or click an example below to see the format specification you need.

👈 👆 Paste desired output (or click for example)

Format Specifications

No formats detected
Enter your output string above

Sample Code

variable = 1970.5
formatted = f"{variable:,.2f}"
print(formatted)  # Output: 1,970.50

Common Format Examples

Don't have a formatted string? Click an example string to analyze it or click a format specification to copy it.

Numbers and Strings

Description Example Output Format Specification Example Input

Dates and Times

Description Example Output Format Specification

Related F-string Tools

For datetime formatting and parsing help, see https://pym.dev/strptime.

For a reference guide to Python's f-string format specifications, see my article on how to use Python's f-strings or checkout fstring.help/cheat.

If you need very thorough reference, check out the official Format Specification Mini-Language documentation.

If you think you've found a formatting edge case or bug on this page, please report it to help@pythonmorsels.com.