I have a tuple contains both string and float values (which are read from a txt file and calculated by me, respectively) and I want to write it to another txt file.
variables = (line.split()[0],line.split()[1], velocity) #velocity is a floating number, others are #string
output_file.write('%s %s %4.2f \n' % variables)
These lines are in a for loop. I want to align each variable in each line as right justified. How can I do that?
Please note that string items don't have same character in each line.