How to format printing stmt in python?
print"---------------------------------"
print"client:mount-point:logfile:status"
print"---------------------------------"
print clientname,mntpt,logfile,status
Currently it prints something like this :
---------------------------------
client:mount-point:logfile:status
---------------------------------
client01 : /some/path/mnt/1007/1 : /export/something/laks/specs_dir/log/client1/gc.log:running
How to make this output better?. Any suggestions
gimel
87k10 gold badges80 silver badges104 bronze badges
asked Mar 23, 2010 at 12:45
webminal.org
47.8k37 gold badges100 silver badges129 bronze badges
-
It works. What's the problem?S.Lott– S.Lott2010年03月23日 13:04:56 +00:00Commented Mar 23, 2010 at 13:04
-
Duplicate: stackoverflow.com/questions/543399/python-string-formattingbignose– bignose2010年03月23日 13:07:00 +00:00Commented Mar 23, 2010 at 13:07
3 Answers 3
Take a look at string formatting : http://docs.python.org/release/2.5.2/lib/typesseq-strings.html
answered Mar 23, 2010 at 12:59
Michael Anderson
74.3k9 gold badges148 silver badges196 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
If you're trying to format a table, consider using other software for table formatting.
As an example, you can produce HTML with the print statements and view the table with a browser. Another option is to generate csv data to be viewed using a spreadsheet program.
answered Mar 23, 2010 at 13:03
gimel
87k10 gold badges80 silver badges104 bronze badges
Comments
Stick some tab spacing in for a start?
'\t'
Comments
lang-py