(Oct-09-2017, 08:59 AM)buran Wrote: b designates it as binary string.Just to correct that a little,it's bytes string.
You show the correct way with
txt.decode('utf-8')
Everything that it's not decoded into Python 3 will be
bytes
.He could have decoded earlier:
mydata = pd.read_sas('C:\\Users\\00124118\\Desktop\\call_center_data.sas7bdat', encoding='utf-8')
Just to show a binary string:
>>> bin_string = bin(22) >>> bin_string '0b10110' >>> int(bin_string, 2) 22The normal way that most encounter this in Python 3 is bytes.
>>> s = b'hello' >>> s b'hello' >>> type(s) <class 'bytes'> >>> # To python 3 string which is Unicode >>> s = s.decode('utf-8') # or just decode() >>> s 'hello' >>> type(s) <class 'str'>