0

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
  • 83,368
  • 10
  • 76
  • 104
webminal.org
  • 44,948
  • 37
  • 94
  • 125

3 Answers3

1

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

Michael Anderson
  • 70,661
  • 7
  • 134
  • 187
0

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
  • 83,368
  • 10
  • 76
  • 104
0

Stick some tab spacing in for a start?

'\t'
goose_wh
  • 77
  • 1
  • 3