Mega Code Archive

 
Categories / Python Tutorial / String
 

Format Operator Auxiliary Directives

Symbol          Functionality *              Argument specifies width or precision -               Use left justification +               Use a plus sign ( + ) for positive numbers <sp>            Use space-padding for positive numbers #               Add the octal leading zero ('0') or hexadecimal leading '0x' or '0X', depending on whether 'x' or 'X' were used. 0               Use zero-padding (instead of spaces) when formatting numbers %               '%%' leaves you with a single literal '%' (var)           Mapping variable (dictionary arguments) m.n              m is the minimum total width and n is the number of digits to display after the decimal point (if applicable)