Slicing strings in str.format

No, you can’t apply slicing to strings inside a the replacement field.

You’ll need to refer to the Format Specification Mini-Language; it defines what is possible. This mini language defines how you format the referenced value (the part after the : in the replacement field syntax).

Leave a Comment