views:

49

answers:

3

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

+1  A: 

Take a look at string formatting : http://docs.python.org/release/2.5.2/lib/typesseq-strings.html

Michael Anderson
A: 

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.

gimel
A: 

Stick some tab spacing in for a start?

'\t'
goose_wh