0% found this document useful (0 votes)
14 views

Python Modifiers

In Python, modifiers are constructs or tools that modify the behavior, scope, or attributes of variables, functions, or classes. While Python does not explicitly use the term "modifier" as in some other programming languages, several mechanisms serve this purpose.

Uploaded by

btechcseamar2022
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Python Modifiers

In Python, modifiers are constructs or tools that modify the behavior, scope, or attributes of variables, functions, or classes. While Python does not explicitly use the term "modifier" as in some other programming languages, several mechanisms serve this purpose.

Uploaded by

btechcseamar2022
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Python Modifiers (Formatting Types)

Here is a list of all the formatting types.

Formatting Types Descriptions

:< Left aligns the result (within the available space)

:> Right aligns the result (within the available space)

:^ Center aligns the result (within the available space)

:= Places the sign to the left most position

:+ Use a plus sign to indicate if the result is positive or negative

:- Use a minus sign for negative values only

: Use a space to insert an extra space before positive numbers (and a minus sign
before negative numbers)

:, Use a comma as a thousand separator

:_ Use a underscore as a thousand separator

:b Binary format

:c Converts the value into the corresponding Unicode character

:d Decimal format

:e Scientific format, with a lower case e

:E Scientific format, with an upper case E

:f Fix point number format

:F Fix point number format, in uppercase format


(show inf and nan as INF and NAN )

:g General format

:G General format (using a upper case E for scientific notations)

:o Octal format

:x Hex format, lower case

:X Hex format, upper case

:n Number format

:% Percentage format

Note: This list is taken from W3Schools.

You might also like