The first optional field of the format specification is flags. A flag directive is a character that justifies output and prints signs, blanks, decimal points. More than one flag directive may appear in a format specification.
Flag Meaning Default – Left align the result within the given field width. Right align. + Prefix the output value with a sign (+ or –) if the output value is of a signed type. Sign appears only for negative signed values (–). 0 If width is prefixed with 0, zeros are added until the minimum width is reached. If 0 and – appear, the 0 is ignored. No padding. blank (' ') Prefix the output value with a blank if the output value is signed and positive; the blank is ignored if both the blank and + flags appear. No blank appears. # When used with the e, or f format the # flag forces the output value to contain a decimal point in all cases. Decimal point appears only if digits follow it. When used with the g format, the # flag forces the output value to contain a decimal point in all cases and prevents the truncation of trailing zeros. Decimal point appears only if digits follow it. Trailing zeros are truncated.