1 Upvote

Python Format Decimal to Percentage Without Multiplying by 100 Using str.format()

Python
General Python

Formats decimal as percentage with 2 decimal points using str.format.

decimal = 0.34467
"{:.2%}".format(decimal)

>> '34.47%'

By GregHe1979 - Last Updated July 24, 2022, 12:12 p.m.

Did you find this snippet useful?

Sign up to bookmark this in your snippet library

COMMENTS
RELATED SNIPPETS
Python For Else Loop
Python
General Python

Loop

2
Top Contributors
103
100