当前位置:主页 > 软件编程 > Python代码 >

python获取中文字符串长度的方法

时间:2021-01-30 10:28:02 | 栏目:Python代码 | 点击:

如下所示:

print len('哈哈'.decode('utf-8')) #unicode格式
print len('哈哈') #utf-8格式

您可能感兴趣的文章:

相关文章