2015-09-26 83 views
-3
average = total/words 
zs  = words/lines 

print("BLABLABLA: ", round(average)) 
print("BLABLA: ", round(zs)) 

如何正确打印彼此的两个输出? (%d ??)在列中打印输出

请帮助

回答

2

使用str.format方法:

print("BLABLABLA: {: >10}".format(round(average))) 
print("BLABLA: {: >10}".format(round(zs))) 
+0

什么是'的宗旨:括号内> 10'? –

+1

@DavidZemens强制字段在可用空间内左对齐(这是大多数对象的默认对象)。阅读链接中的更多文档 – Kasramvd

+0

非常感谢! ! –