Calculate bytes of the unicode character in python -


i'm writing python script read unicode characters file , insert them database. can insert 30 bytes of each string. how calculate size of string in bytes before insert database?

suppose reading unicode characters file variable called bytestring. can following:

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

Comments