I am printing values from a table to a text file.
When printing the column for price, regardless of the actual price in the table, I need to make sure it fits into 10 digits which will then be printed to a text file.
For example:
The price in the table is $1.45.
When I print to the file, it needs to read as: 00000001.45
My first thought was to use the 'len" function to determine how many characters are in the price, then append based on this [append values =~ 10 - len(price)]. However, this does not work when I have a price of $1.00. For that instance, len gives the value of "1", when it should give "4".
Example code or a function that does this would be nice. Appreciate the help.
When printing the column for price, regardless of the actual price in the table, I need to make sure it fits into 10 digits which will then be printed to a text file.
For example:
The price in the table is $1.45.
When I print to the file, it needs to read as: 00000001.45
My first thought was to use the 'len" function to determine how many characters are in the price, then append based on this [append values =~ 10 - len(price)]. However, this does not work when I have a price of $1.00. For that instance, len gives the value of "1", when it should give "4".
Example code or a function that does this would be nice. Appreciate the help.