Skip to content

Commit 7702d1e

Browse files
committed
style: better as a code comment
Addressing #1023 (comment)
1 parent e4b4868 commit 7702d1e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

sources/academy/webscraping/scraping_basics_python/05_parsing_html.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,11 @@ response = httpx.get(url)
4545
response.raise_for_status()
4646

4747
html_code = response.text
48+
# use single quotes as string boundaries, because the substring contains a double quote character
4849
count = html_code.count('<div class="product-item ')
4950
print(count)
5051
```
5152

52-
Note that because the substring contains a double quote character, we need single quotes as string boundaries.
53-
5453
:::info Handling errors
5554

5655
To have the code examples more concise, we're omitting error handling for now. Keeping `response.raise_for_status()` ensures that your program at least visibly crashes and prints what happened in case there's an error.

0 commit comments

Comments
 (0)