Detecting empty string when decoding byte array into unicode? (Python) -
Detecting empty string when decoding byte array into unicode? (Python) -
i'm trying read array of bytes character character , decode unicode string, below:
current_character = byte_array[0:1].decode("utf-8")
for each character, i'm trying check whether result of .decode("utf-8") equals empty string, can't seem able observe this. when print out result of decoding, empty string. how translate detection code?
i've tried:
if not current_character if current_character u""
but both don't work. suggestions?
try this:
if current_character == '': print('empty string')
python unicode
Comments
Post a Comment