【发布时间】:2014-04-30 17:34:23
【问题描述】:
如何修复这个程序,以便我可以计算字母的数量以及如何计算单词?
import collections as c
text = input('Enter text')
print(len(text))
a = len(text)
counts = c.Counter(a)
print(counts)
spaces = counts(' ')
print(specific)
print(a-spaces)
#I want to count the number of letters so I want the amount of characters - the amount of
#spaces.
【问题讨论】:
-
您可能想先存储
len(text),然后再使用变量。
标签: python