Python: Format String (Convert to String)
Ways to format string
Format String lets you embed values in a template string, or convert different type of values to string.
To format a string:
- Python: f-String (Format, Template) → best
- Python: The .format (String Method) → good
- Python: Convert to String (repr, str) → useful for number to string.
- Python: Print with Percent Format String → bad