In C# and other languages, a hash (#) in the format string will be replaced by a number if one exists, and nothing if it doesn't. So a string such as:
number1 = 12.3456
number2 = 12.3
String.Format("0.00####", number1)
String.Format("0.00####", number2)
Will output number1 = 12.3456 but number2 = 12.30. A zero in the format string means if there isn't enough decimal numbers, a zero will be printed out instead.
My question is, is there a similar functionality in Python? I know I can use "{:.6F}" to format a number to 6 decimal points.
string.format()function.