summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFbenas <philbeansburton@gmail.com>2020-11-08 13:56:45 +0000
committerFbenas <philbeansburton@gmail.com>2020-11-08 13:56:45 +0000
commit800816300ef0712aa586f85debcbc76982dd0c30 (patch)
treef774a37754c8cf1e9388824b039c514693e044c1
parentecf048b9c1fafffd8e6da1e666740c0311b50b7e (diff)
Convert strings to ints
-rwxr-xr-xbladictionary.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/bladictionary.py b/bladictionary.py
index 9fe1827..4e3b196 100755
--- a/bladictionary.py
+++ b/bladictionary.py
@@ -214,11 +214,10 @@ def parse_oed(word):
definition = ""
word_type = ""
for part in line.split(" ")[word_len:]:
-
#If we've reached a word type, add the current data to the list
if part in types.keys():
#Don't add empty definitions
- if id > 0 and definition != " " and definition:
+ if int(id) > 0 and definition and definition != " ":
item = Definition(word, id, "oed", word_type, definition, [], [], [])
items.append(item)
definition = ""
@@ -410,7 +409,7 @@ def main():
if all_types:
found_type = False
cur_id = type_id
- if item.id < page_num:
+ if int(item.id) < page_num:
if item.id != 0:
continue
elif item.id == 0 and page_num > 1:
@@ -438,7 +437,7 @@ def main():
else:
# Ignore anything after a line break as this breaks output
item_definition = item.definition.split("\n")[0]
- if item.id > 0:
+ if int(item.id) > 0:
definition = item.word_type + " " + str(item.id) + ": " + item_definition
else:
definition = item.word_type + ": " + item_definition