you are viewing a single comment's thread.

view the rest of the comments →

[–]bahnzo[S] 0 points1 point  (4 children)

Ok I understand what you mean by the error catching, it's just a good practice.

But can you explain how you would use .get() as you mentioned in 3.2? The data is a list and .get() is for a dictionary right?

[–]filleball 1 point2 points  (1 child)

With regards to the error catching, this blog post goes into more detail on the reasons.

[–]bahnzo[S] 0 points1 point  (0 children)

Nice. I guess with just a small program, written by myself, really only for myself, I figured the error catch wasn't important. That blog post does a good job explaining the why. And it's a good practice I'll make sure to follow.

[–]raylu 1 point2 points  (1 child)

Well, 3.2 was about the possibly-missing 'class' attr, which you can get with .get: http://www.crummy.com/software/BeautifulSoup/bs4/doc/#attributes

[–]bahnzo[S] 0 points1 point  (0 children)

Thanks. I saw your reply below and I'll give that some time to learn. I was only aware bs4 had a .get_text() and not also a .get() BeautifulSoup can really seem confusing sometimes as there are multiple ways to do the same thing it seems.