DO NOT DEAL WITH THIS MEMBER
Apr 16, 2020 03:57 PM
(This post was last modified: Apr 16, 2020 05:16 PM by SIM-1866423.)
After many years first time i need help on scraping my brain unfunctional right now 🤮
Code <body contenteditable="true" dir="ltr" class="">
<div>text text</div>
<div>text text</div>
<div>text text</div>
<div>text text</div>
<div>text text</div>
</body>
How can i get inside text from this.
If you're trying to get the "SOMETHING SOMETHING SOMETHING" text (clarify please):
Code from bs4 import BeautifulSoup
soup = BeautifulSoup(html_doc, 'html.parser')
result = soup.find('body')
DO NOT DEAL WITH THIS MEMBER
(Apr 16, 2020 04:00 PM)4Txe4y33C9zvNhMj Wrote: If you're trying to get the "SOMETHING SOMETHING SOMETHING" text (clarify please):
Code from bs4 import BeautifulSoup
soup = BeautifulSoup(html_doc, 'html.parser')
result = soup.find('body')
yeap sorry you are right i just update question, all div tags.
(Apr 16, 2020 04:29 PM)SIM-1866423 Wrote: yeap sorry you are right i just update question, all div tags.
Updated:
Code from bs4 import BeautifulSoup
soup = BeautifulSoup(html)
for div in soup.find_all("div"):
print("content: {}".format(div.text))
DO NOT DEAL WITH THIS MEMBER
Apr 16, 2020 04:56 PM
(This post was last modified: Apr 16, 2020 04:58 PM by SIM-1866423.)
(Apr 16, 2020 04:49 PM)4Txe4y33C9zvNhMj Wrote: Updated:
Code from bs4 import BeautifulSoup
soup = BeautifulSoup(html)
for div in soup.find_all("div"):
print("content: {}".format(div.text))
Thats not helping unfortunately.Thats why im asking, i just need div tags inside of this specific body tags.There a lot of div tags at outside of this body tags ..
(Apr 16, 2020 04:56 PM)SIM-1866423 Wrote: Thats not helping unfortunately.Thats why im asking, i just need div tags inside of this specific body tags.There a lot of div tags at outside of this body tags ..
Could you elaborate?
You're trying to select all div tags in the body that have what feature?
DO NOT DEAL WITH THIS MEMBER
Apr 16, 2020 05:05 PM
(This post was last modified: Apr 16, 2020 05:06 PM by SIM-1866423.)
(Apr 16, 2020 05:02 PM)4Txe4y33C9zvNhMj Wrote: Could you elaborate?
You're trying to select all div tags in the body that have what feature?
No feature or anything table exact same in first post.
(Apr 16, 2020 05:05 PM)SIM-1866423 Wrote: No feature or anything table exact same in first post. You want to select the text from all the divs within the body element, correct? You're being so incredibly vague in every single post. Learn how to express your thoughts clearly.
Je t'aime
(Apr 22, 2022 04:39 PM)-Scrub Wrote: Jokes on you, I'm not smart enough to know what he's talking about.
DO NOT DEAL WITH THIS MEMBER
(Apr 16, 2020 05:09 PM)Nachfolger Wrote: You want to select the text from all the divs within the body element, correct? You're being so incredibly vague in every single post. Learn how to express your thoughts clearly.
I have literally 0 idea how this ambiguous but fine.
(Apr 16, 2020 05:21 PM)SIM-1866423 Wrote: ![[Image: KXoah7n.png]](https://i.imgur.com/KXoah7n.png)
I have literally 0 idea how this ambiguous but fine. You just need the text from each div? You said that outside of the body there are div tags, and you want to ignore them, but the screenshot you provided (in OP) has no divs outside of the body.
1. All divs in the screenshot are IN THE BODY
2. The code provided earlier pulls the text from inside each div
Again, I'm not seeing an issue.
Je t'aime
(Apr 22, 2022 04:39 PM)-Scrub Wrote: Jokes on you, I'm not smart enough to know what he's talking about.
|