python get unicode string size

前端 未结 1 485
心在旅途
心在旅途 2020-12-15 06:16

I have a binary file. This file contains an UTF-8 string. Moreover, it is guaranteed that this string is just a single word. In python, how can I get number of letters in th

1条回答
  •  孤街浪徒
    2020-12-15 06:25

    unicode_string = bytes.decode("utf-8")
    print len(unicode_string)
    

    0 讨论(0)
提交回复
热议问题