diff --git a/headphones/helpers.py b/headphones/helpers.py index ce29deef..e1fc3045 100644 --- a/headphones/helpers.py +++ b/headphones/helpers.py @@ -94,7 +94,7 @@ def latinToAscii(unicrap): r = '' for i in unicrap: - if xlate.has_key(ord(i)): + if ord(i) in xlate: r += xlate[ord(i)] elif ord(i) >= 0x80: pass diff --git a/headphones/lyrics.py b/headphones/lyrics.py index ea6fcd8f..2968725c 100644 --- a/headphones/lyrics.py +++ b/headphones/lyrics.py @@ -81,7 +81,7 @@ def convert_html_entities(s): hits.remove(amp) for hit in hits: name = hit[1:-1] - if htmlentitydefs.name2codepoint.has_key(name): - s = s.replace(hit, unichr(htmlentitydefs.name2codepoint[name])) + if name in htmlentitydefs.name2codepoint: + s = s.replace(hit, unichr(htmlentitydefs.name2codepoint[name])) s = s.replace(amp, "&") return s