2010-03-23 160 views
0

如何格式化打印stmt在Python中?格式打印

print"---------------------------------" 

print"client:mount-point:logfile:status" 

print"---------------------------------" 

print clientname,mntpt,logfile,status 

目前它打印是這樣的:

--------------------------------- 

client:mount-point:logfile:status 

--------------------------------- 

client01 : /some/path/mnt/1007/1 : /export/something/laks/specs_dir/log/client1/gc.log:running 

如何使這個輸出更好?任何建議

+3

它有什麼意義更好? – 2010-03-23 12:53:12

+0

它的工作原理。有什麼問題? – 2010-03-23 13:04:56

+0

Duplicate:http://stackoverflow.com/questions/543399/python-string-formatting – bignose 2010-03-23 13:07:00

回答

0

如果你想格式化的表格,可以考慮使用其他軟件的表格格式。

作爲示例,您可以使用print語句生成HTML並使用瀏覽器查看錶。另一個選項是生成csv數據以使用電子表格程序進行查看。

0

粘貼一些標籤間距爲開始?

'\t'