1)这个是要求你手工完成的吧,你搞到以后,假定保存的文件名为 words.txt
2)代码为import re
pa = r'\b(.+?)\b'
words = open('words.txt','r').read()
for i in re.findall(pa,words):
print(i.lower())
3) 代码为import re
pa = r'\b(.+?)\b'
total = 0
words = open('words.txt','r').read()
print(len(re.findall(pa,words)))
4) 代码为import re
pa = r'\b(.+?)\b'
total = 0
words = open('words.txt','r').read()
words_dic={}
for i in re.findall(pa,words):
t = i.lower()
if t in words_dic:
words_dic[t]+=1
else:
words_dic[t]=1
for i in words_dic:
print(i,words_dic[i])
5) 柱状图是啥?excel?
其他的代码如下:import re
pa = r'\b(.+?)\b'
total = 0
words = open('words.txt','r').read()
words_dic={}
for i in re.findall(pa,words):
t = i.lower()
if t in words_dic:
words_dic[t]+=1
else:
words_dic[t]=1
not_key = ['a','is','the']
n=10
for word in sorted(words_dic.keys())[::-1]:
if not word in not_key:
print(word,words_dic[word])
n-=1
if n==0:
break
6) 我就不做了,gui写起来麻烦