mirror of
https://github.com/cooperhammond/irs.git
synced 2025-01-02 19:15:26 +00:00
python 3 compatibility
This commit is contained in:
parent
db850af7c1
commit
73c7f9676a
10
irs/utils.py
10
irs/utils.py
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue