It understands about plus and minus signs:import stringprint string.zfill('12', 5)print string.zfill('-3.14', 7)print string.zfill('3.14159265359', 5)