python 3 compatibility

This commit is contained in:
Kepoor Hampond 2017-06-05 19:37:16 -07:00
parent db850af7c1
commit 73c7f9676a

View file

@ -58,11 +58,11 @@ class YdlUtils:
def set_utf8_encoding(ld): # ld => a list or dictionary with strings in it def set_utf8_encoding(ld): # ld => a list or dictionary with strings in it
if type(ld) == dict: if type(ld) == dict:
for k, v in ld.iteritems(): for k in ld:
if type(v) == dict or type(v) == list: if type(ld[k]) == dict or type(ld[k]) == list:
ld[k] = set_utf8_encoding(v) ld[k] = set_utf8_encoding(ld[k])
elif type(v) == str: elif type(ld[k]) == str:
ld[k] = v.encode('utf-8') ld[k] = ld[k].encode('utf-8')
elif type(ld) == list: elif type(ld) == list:
for index, datum in enumerate(ld): for index, datum in enumerate(ld):
if type(datum) == str: if type(datum) == str: