中英文混合,词数如何统计? ::-- ZoomQuiet [2007-05-08 02:39:44]
Contents
CPUG联盟::
CPUG::门户plone
BPUG
SPUG
ZPUG
SpreadPython Python宣传
CPyUG:26258- 中英文混合,词数如何统计?
1 import re 2 cjkReg = re.compile(u'[\u1100-\uFFFDh]+?') 3 trimedCJK = cjkReg.sub( ' a ', inputString, 0)# replace the CJK with the word a 4 return len(trimedCJK.split())