发布时间:2019-06-23 08:43:49编辑:auto阅读(2312)
需求: 统计一篇完全由英文构成的文章中的单词的个数
分析:需要判断什么是单词,并统计判断为单词的元素的个数
需要: Python 正则表达式
简单例子:
import re
pattern  = re.compile(r'\w+')
pattern.match('hello ,world')
words = pattern.findall('hello hello  world')
len(words)
上一篇: python—函数实例二
下一篇: python选择排序简单实现
 51193
 50608
 41233
 38049
 32512
 29419
 28280
 23135
 23093
 21431
 1485°
 2202°
 1823°
 1752°
 2063°
 1813°
 2498°
 4193°
 4054°
 2894°