image1 image2 image3 image3 image3 image3 image3

HELLO I'M SHASHI|WELCOME TO MY PERSONAL BLOG|I LOVE TO DO CREATIVE THINGS|I'M CYBER SECURITY STUDENT

Python String Formatting

 

        Python String Formatting




Here is a list of all the formatting types.



Formatting Types
:<Try itLeft aligns the result (within the available space)
:>Try itRight aligns the result (within the available space)
:^Try itCenter aligns the result (within the available space)
:=Try itPlaces the sign to the left most position
:+Try itUse a plus sign to indicate if the result is positive or negative
:-Try itUse a minus sign for negative values only
Try itUse a space to insert an extra space before positive numbers (and a minus sign before negative numbers)
:,Try itUse a comma as a thousand separator
:_Try itUse a underscore as a thousand separator
:bTry itBinary format
:cConverts the value into the corresponding Unicode character
:dTry itDecimal format
:eTry itScientific format, with a lower case e
:ETry itScientific format, with an upper case E
:fTry itFix point number format
:FTry itFix point number format, in uppercase format (show inf and nan as INF and NAN)
:gGeneral format
:GGeneral format (using a upper case E for scientific notations)
:oTry itOctal format
:xTry itHex format, lower case
:XTry itHex format, upper case
:nNumber format
:%Try itPercentage format

Share this:

CONVERSATION

0 Comments:

Post a Comment