webminal.org
webminal.org

Reputation: 47316

format printing

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

Upvotes: 0

Views: 479

Answers (3)

goose_wh
goose_wh

Reputation: 77

Stick some tab spacing in for a start?

'\t'

Upvotes: 0

gimel
gimel

Reputation: 86502

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.

Upvotes: 0

Michael Anderson
Michael Anderson

Reputation: 73600

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

Upvotes: 1

Related Questions