From 26297743a31bdc8def4bb2fea61de07dd4ed30ab Mon Sep 17 00:00:00 2001 From: 644a273c12700e0fdb30d56b <644a273c12700e0fdb30d56b@devide> Date: Fri, 28 Apr 2023 10:23:40 +0000 Subject: [PATCH] UPDATE --- main.py | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/main.py b/main.py index f30e8f4..d5860d5 100644 --- a/main.py +++ b/main.py @@ -1,20 +1,8 @@ -import requests -from bs4 import BeautifulSoup +from redlines import Redlines -url = 'http://quote.eastmoney.com/ztb' -try: - res = requests.get(url, timeout=5) - soup = BeautifulSoup(res.text, 'html.parser') -except requests.exceptions.RequestException as e: - print(e) - exit() -print(soup) -hot_stocks = soup.select('#ztgc-box a') -print(hot_stocks) -if hot_stocks: - for stock in hot_stocks: - name = stock.select_one('.title a').text - code = stock.select_one('.title span').text - print(name, code) -else: - print('No hot stocks found.') +test = Redlines("The quick brown fox jumps over the lazy dog.") +assert test.compare( + 'The quick brown fox walks past the lazy dog.') == "The quick brown fox jumps over walks past the lazy dog." + +assert test.compare( + 'The quick brown fox jumps over the dog.') == 'The quick brown fox jumps over the lazy dog.' \ No newline at end of file -- GitLab