版权声明:本文为博主原创文章,转载请表明来源和网址。 https://blog.csdn.net/thinbug/article/details/85167202
txt = '名字12'
lenTxt = len(txt)
lenTxt_utf8 = len(txt.encode('utf-8'))
size = int((lenTxt_utf8 - lenTxt)/2 + lenTxt)
print("size = " , size ," ,urf8 = ",lenTxt_utf8," ,len = " ,lenTxt)