May-26-2019, 11:30 AM
(May-26-2019, 01:13 AM)Skaperen Wrote: is there an easy way to output numbers in a simple print() call in a fixed width?
I don't know whether it qualifies as 'easy way', but there is str.rjust (also str.ljust)
>>> help(str.rjust) Help on method_descriptor: rjust(self, width, fillchar=' ', /) Return a right-justified string of length width. Padding is done using the specified fill character (default is a space). (END) >>> '42'.rjust(5) ' 42' >>> '42'.rjust(5,'*') '***42'
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.