From 363fdc1f0f9449af00ced3a72e88ad1c4f794ac7 Mon Sep 17 00:00:00 2001 From: socal-nerdtastic <37753609+socal-nerdtastic@users.noreply.github.com> Date: Sat, 7 Nov 2020 20:52:37 -0800 Subject: [PATCH] Fix #35: index error when word is not found When the word is not found the error message is in an h3 tag. Update to use zip() which ensures a matching ul tag for every h3 tag. --- PyDictionary/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PyDictionary/core.py b/PyDictionary/core.py index 1eb7298..12dd9b5 100644 --- a/PyDictionary/core.py +++ b/PyDictionary/core.py @@ -122,8 +122,8 @@ def meaning(term, disable_errors=False): length = len(types) lists = html.findAll("ul") out = {} - for a in types: - reg = str(lists[types.index(a)]) + for a, reg in zip(types, lists): + reg = str(reg) meanings = [] for x in re.findall(r'\((.*?)\)', reg): if 'often followed by' in x: