I have a string that is to be sent over a network. I need to check the total bytes it is represented in.
sys.getsizeof(string_name)
returns extra bytes. For example for sys.getsizeof("a")
returns 22 , while one character is only represented in 1 byte in python. Is there some other method to find this ?