【发布时间】:2015-07-20 10:52:26
【问题描述】:
def formatWords(words):
result = "Word List:\tWord Count:\n"
for i in words:
result += i + ":\t" + str(words.count(i)) + "\n"
return result
words 只是一个字符串数组。
我应该得到一个输出
我得到了
的输出如何将字符串格式化为看起来像第一张图片?
【问题讨论】:
-
这个问题的几个重复,例如stackoverflow.com/questions/19103052/…
标签: python python-3.x