Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reading a Regex pattern
#9
Yes and there is more than one way.
The method find() should return only one result.
Then you have also find_all() which returns a list with all elements which matches the pattern.

result = bs.find('h1')
text_in_tag = result.text
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
Reading a Regex pattern - by stahorse - Apr-24-2019, 07:37 AM
RE: Reading a Regex pattern - by Gribouillis - Apr-24-2019, 10:53 AM
RE: Reading a Regex pattern - by DeaD_EyE - Apr-24-2019, 11:59 AM
RE: Reading a Regex pattern - by snippsat - Apr-24-2019, 04:53 PM
RE: Reading a Regex pattern - by stahorse - Apr-25-2019, 05:45 AM
RE: Reading a Regex pattern - by stahorse - Apr-25-2019, 06:50 AM
RE: Reading a Regex pattern - by DeaD_EyE - Apr-25-2019, 07:05 AM
RE: Reading a Regex pattern - by stahorse - Apr-25-2019, 07:32 AM
RE: Reading a Regex pattern - by DeaD_EyE - Apr-25-2019, 07:43 AM
RE: Reading a Regex pattern - by snippsat - Apr-25-2019, 08:13 AM
RE: Reading a Regex pattern - by stahorse - Apr-25-2019, 08:44 AM
RE: Reading a Regex pattern - by snippsat - Apr-25-2019, 10:13 AM
RE: Reading a Regex pattern - by NewBeie - Apr-25-2019, 10:21 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Regex pattern match WJSwan 2 1,362 Feb-07-2023, 04:52 AM
Last Post: WJSwan
  regex pattern to extract relevant sentences Bubly 2 1,947 Jul-06-2021, 04:17 PM
Last Post: Bubly
  Reading a Regex stahorse 4 2,581 May-16-2019, 02:09 PM
Last Post: snippsat
  Regex Pattern NewBeie 5 3,184 May-13-2019, 01:27 PM
Last Post: michalmonday
  Regex, creating a pattern stahorse 5 3,282 Apr-24-2019, 08:29 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

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