Apr-22-2017, 10:45 AM
It would help if we could see the data you are trying to format. It looks from your desired output that position and velocity are tuples of the three dimensional components of position and velocity. You will have to format each tuple separately, and then combine the results in with the formatting of any non-tuple data.
position = (801, 23, 2.718281828) position_text = '({:3g}, {:3g}, {:3g})'.format(*position)The * syntax converts a sequence into a sequence of parameters.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures