怎么分割中英混字符串 py2x
例如:
str = '我x是中国a人c'
分割成:['我','x','是','中','国','a','人','c']
str = '我是中国人'
strList = []
for s in str :
strList.append(s)
print strList
#结果:['\xe6', '\x88', '\x91', '\xe6', '\x98', '\xaf', '\xe4', '\xb8', '\xad', '\xe5', '\x9b', '\xbd', '\xe4', '\xba', '\xba']
str.split()也用了,这不是我想要的结果,因为我要算长度。如果只是单纯的中文可以知道list长度,但中英混的不能用正则先匹配中文,在匹配里面的英文在计算字节吧,python应该有更简便的方法吧
1:使用python3
2:tr = u'我x是中国a人c'