Play SAH
Search
Log in
Register
/
Forams
SUPERJER FORAMS
≡
Forum Index
Play SAH
Search
Register
Log in
SuperJer.com
Make python spit out results that's all pretty like
Make python spit out results that's all pretty like
if( while ) switch{ coding } ++
— Page [1]
buq25
2008 Jul 5 • 583
295 ₧
What it's like:
What I want it to be like(simulated using Mspaint):
Is there any fancy thing to do that? Like pressing tab in most text editors.
Today's post brought to you by the letter: "heck".
≡
2016 Apr 2 at 08:02 UTC — Ed. 2016 Apr 2 at 08:09 UTC
phoenix_r
2009 May 13 • 905
17 ₧
I don't know python really so I'm sure there's something better than this, but one solution is to count the length of each component of the output and then pad the rest with the necessary amount of spaces.
BOO
≡
2016 Apr 7 at 08:34 UTC
SuperJer
Websiteman
2005 Mar 21 • 6666
Maybe use rjust:
python code
str(6.55).rjust(10)
Just make sure the 10 is enough width.
≡
2016 Apr 7 at 17:04 UTC
phoenix_r
2009 May 13 • 905
17 ₧
SuperJer said:
Maybe use rjust:
python code
str(6.55).rjust(10)
Just make sure the 10 is enough width.
This looks like that better way that I mentioned.
BOO
≡
2016 Apr 7 at 20:36 UTC
Page [1]