From 9473b4fee5b70f07571b75941c9e951be1351976 Mon Sep 17 00:00:00 2001 From: Cychih Date: Wed, 31 Aug 2016 21:27:09 +0800 Subject: [PATCH] [#100] prevent ``KeyError`` being caused crash --- zdict/dictionaries/yahoo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zdict/dictionaries/yahoo.py b/zdict/dictionaries/yahoo.py index 7af974a0..af1f9797 100644 --- a/zdict/dictionaries/yahoo.py +++ b/zdict/dictionaries/yahoo.py @@ -116,7 +116,7 @@ def query(self, word: str): for example in ( tag for tag in item.find_all('span') - if 'line-height: 17px;' not in tag['style'] + if 'line-height: 17px;' not in tag.get('style', {}) ): sentence = ''