Skip to content

Latest commit

 

History

History
23 lines (16 loc) · 353 Bytes

88.md

File metadata and controls

23 lines (16 loc) · 353 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(个字节)
[上一个例子](87.md) [下一个例子](89.md)