Python Forum
how to convert string soup to raw string ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to convert string soup to raw string ?
#7
snippsat,

your example works for the sample html in your demo code but can you give me an explanation of the syntax following soup.select in these two lines...

print(soup.select('body > p')[0].text)
print(soup.select('#foo')[0].text)

I searched for Beautiful Sup select method but guess I missed explanations for terms like...
('body > p')[0].text)
('#foo')[0].text)
Can you give me some explanation and maybe a linke to the arguments/syntax for the bs select method?
thanks
Reply


Messages In This Thread
RE: how to convert string soup to raw string ? - by Fran_3 - Aug-16-2017, 11:42 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Soup('A') new_coder_231013 6 2,831 Aug-12-2023, 10:55 AM
Last Post: Pubfonts
  Scrape for html based on url string and output into csv dana 13 5,701 Jan-13-2021, 03:52 PM
Last Post: snippsat
  How to send unicode string encoded in utf-8 in http request in Python MaverinCode 1 32,789 Nov-08-2020, 06:45 AM
Last Post: JaiM
  string parsing with re.search() delahug 9 3,812 Jun-04-2020, 07:02 PM
Last Post: delahug
  URL String with parameters nikoloz 14 6,221 May-15-2020, 08:20 AM
Last Post: DeaD_EyE
  Pandas tuple list returning html string shansaran 0 1,828 Mar-23-2020, 08:44 PM
Last Post: shansaran
  Cannot get contents from ul.li.span.string LLLLLL 8 4,148 Nov-29-2019, 10:30 AM
Last Post: LLLLLL
  [Learning:bs4, re.search] - RegEx string cutoff jarmerfohn 5 3,796 Nov-23-2019, 09:32 AM
Last Post: buran
  ValueError: could not convert string to float Prince_Bhatia 2 4,201 Jan-26-2019, 02:37 PM
Last Post: perfringo
  TypeError: string indices must be integer vanderdecken 1 4,163 Nov-30-2018, 02:24 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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