how to scrape text from <p> without getting unnecessary part in this structure?

web scraping
beautifulsoup
web scraping python beautifulsoup
extract text from website python
web scraping tutorial
beautifulsoup tutorial
how to extract data from html file using python
python web scraping to csv

website code looks like this:

<ul class="article-list">
  <li>
    <p class="promo">
      "sentence sentence sentence sentence"
      <a class="readmore" href="https://link.blahblah.com"> Read more >> </a>
    </p>
  </li>
</ul>

I tried

ul = soup.find_all("ul", class_= "article-list")  
for elem in ul:
    lis = elem.find_all("li")
    for x in lis:
        preview = x.find("p", class_="promo").get_text()

this returns

"sentence sentence sentence sentence     Read more"

How can I return "sentence sentence sentence sentence" only without "Read more"?

You can use .find_next() method with text=True parameter:

data = '''<ul class="article-list">
<li>
<p class="promo">
"sentence sentence sentence sentence"
<a class="readmore" href="https://link.blahblah.com"> Read more >> </a>
</p>
</li>
</ul>'''

from bs4 import BeautifulSoup

soup = BeautifulSoup(data, 'lxml')

print(soup.select_one('p.promo').find_next(text=True))

Prints:

"sentence sentence sentence sentence"

Beautiful Soup: Build a Web Scraper With Python – Real Python, In this tutorial, you'll walk through the main steps of the web scraping Elements by HTML Class Name; Extract Text From HTML Elements�

Im not sure though

preview = x.find("p", class_="promo").a.text

How to scrape text from webpage using beautifulsoup python?, 1. how to convert the unicoded ("") into normal strings as the text in the webpage? because when I only extract "p" tags, the�

you could try adding to a list

soup = bs(resp, 'html.parser')

ul = soup.find_all("ul", class_= "article-list")
preview = []
for elem in ul:
    lis = elem.find_all("li")
    for x in lis:
        preview = x.find("p", class_="promo")
        preview.append(x.text)

How to Web Scrape with Python in 4 Minutes, Web scraping is a technique to automatically access and extract large amounts of information from a website, which can save a huge amount of�

Text selector, Text selector is used for text selection. The text selector will extract text from the selected element and from all its child elements. HTML will be stripped and only�

Web scraping - Text mining & text analysis, Used to extract text from webpages. Web scraping software is designed to recognise different types of content within a website and to acquire�

How to Scrape Text from Associated Press, This tutorial will show you how to scrape text from Associated Press with ScrapeStorm. No Programming Needed. Visual Operation.