Skip to content

Latest commit

 

History

History
20 lines (15 loc) · 282 Bytes

88.md

File metadata and controls

20 lines (15 loc) · 282 Bytes
@author jackzhenguo
@desc 
@date 2019/5/3

88 字符串字节长度

def str_byte_len(mystr):
    return (len(mystr.encode('utf-8')))

测试:

str_byte_len('i love python')  # 13(个字节)
str_byte_len('字符')  # 6(个字节)