环境:python 2
line = "最近还好吗" print len(line.decode("utf-8"))
结果:
5
备注: 直接使用代码:
print len(line)
会得到错误的答案。