例題2.11_2程式碼
import string, random, collections
x = string.ascii_letters + string.digits
y = ' '.join([random.choice(x) for i in range(1000)])
count = collections.Counter(y)
for k, v in sorted(count.items()):
print(k, ':', v)
import string, random, collections
x = string.ascii_letters + string.digits
y = ' '.join([random.choice(x) for i in range(1000)])
count = collections.Counter(y)
for k, v in sorted(count.items()):
print(k, ':', v)