Python como usar o byte_size
January 04, 2020
Returns the length of a string in bytes.
Use s.encode('utf-8') to encode the given string and return its length.
def byte_size(s):
return len(s.encode('utf-8'))byte_size('😀') # 4
byte_size('Hello World') # 11Acesse a Referência original 1: Acesse a Referência original 2: