Python Forum
Where There's A Space In An Object
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Where There's A Space In An Object
#1
Hi all,

In attempting to challenge myself extracting different objects with webscraping and Beautifulsoup, I've come across a small problem that I bet is easy to fix- but I have no idea what to search for in google to find the solution.

If an object has two words, for example in this code:
tag = item.find('div', {'class': 'tagger expired'})
when running the code, I get:
Output:
None
I've figured out that it's not referencing the 'tagger expired' because it's two words. If the object was one word, like 'tagger' or 'expired', it would run fine.

I tried doing something like:
tag = item.find('div', {'class': 'tagger%expired'})
but that returns 'None' also.

Could someone please enlighten me how to deal with an object that has a space between two or more words please?

Thanks a lot.
Reply


Messages In This Thread
Where There's A Space In An Object - by knight2000 - Aug-05-2021, 09:02 AM
RE: Where There's A Space In An Object - by buran - Aug-05-2021, 09:30 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  from global space to local space Skaperen 4 2,384 Sep-08-2020, 04:59 PM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020