improve rules
This commit is contained in:
+5
-4
@@ -6,7 +6,8 @@ html = BeautifulSoup(urlopen('https://telegra.ph/pythonchatru-07-07'), 'lxml')
|
|||||||
|
|
||||||
def get_rule(li):
|
def get_rule(li):
|
||||||
li = int(li)
|
li = int(li)
|
||||||
try:
|
lis = html.find_all('li')
|
||||||
return html.find_all('li')[li - 1].text
|
if li <= len(lis):
|
||||||
except IndexError:
|
return lis[li - 1].text
|
||||||
return 'Нет такого правила.'
|
else:
|
||||||
|
return f'Пока не придумали.'
|
||||||
|
|||||||
Reference in New Issue
Block a user