Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8359593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:11:34+00:00 2026-06-09T11:11:34+00:00

html = … <tt class=descname>all</tt> <big>(</big> <em>iterable</em> <big>)</big> <a class=headerlink href=#all title=Permalink to this

  • 0
html = """
...
<tt class="descname">all</tt>
<big>(</big>
<em>iterable</em>
<big>)</big>
<a class="headerlink" href="#all" title="Permalink to this definition">¶</a>
...
"""

I want to get all text between starting tag big upto before the first occurrence of a tag. This means if I take this example, then i must get (iterable) as a string.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T11:11:35+00:00Added an answer on June 9, 2026 at 11:11 am

    I would avoid nextSibling, as from your question, you want to include everything up until the next <a>, regardless of whether that is in a sibling, parent or child element.

    Therefore I think the best approach is to find the node that is the next <a> element and loop recursively until then, adding each string as encountered. You may need to tidy up the below if your HTML is vastly different from the sample, but something like this should work:

    from bs4 import BeautifulSoup
    #by taking the `html` variable from the question.
    html = BeautifulSoup(html)
    firstBigTag = html.find_all('big')[0]
    nextATag = firstBigTag.find_next('a')
    def loopUntilA(text, firstElement):
        text += firstElement.string
        if (firstElement.next.next == nextATag):             
            return text
        else:
            #Using double next to skip the string nodes themselves
            return loopUntilA(text, firstElement.next.next)
    targetString = loopUntilA('', firstBigTag)
    print targetString
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

html code <li id="ioAddOtherRelation"> <a href="" onclick="return ioAddSetOtherRelation()"class="smallLink">add other relation</a> </li> and i want
HTML: <td align=center width=100%> <a class=Forum_ib_moderate href=Default.aspx title=Moderate></a> <a class=Forum_ib_admin href=Default.aspx title=Admin></a> ... CSS:
I want to run this <!-- This will remove the tag --> <xsl:template name=remove-html>
HTML code <div class='case'> <a href=http://localhost/DXXX/case/reqirement.doc rel=case> view</a> </div> Jquery code $(.case).live('click', function(){ $.fancybox({
Html: <html> <head> <title>Tooltips</title> <link rel=stylesheet type=text/css href=tooltips.css /> </head> <body> <ul> <li tabindex=1>
HTML: <div class=foo>firstBar</div><!-- give this one a different style --> <div class=foo>secondBar</div> <div class=foo>thirdBar</div>
HTML: <div class=iplookup>23.25.49.250</div>; <div class=iplookup>188.2.50.62</div>; jQuery: $(div).mouseup(function () { IP = $(this).text(); $.getJSON(http://api.easyjquery.com/ips/, {
html code <div style=width: 1000px;margin: auto class=cf> <div class=bo data-href=../../link1>click</div> <div class=bo data-href=../../link2>click 2</div>
HTML: <dt> <a href=#profile-experience >Past</a> </dt> <dd> <ul class=past> <li> President, CEO &amp; Founder
html: <html> <head> <title>Home</title> <link rel=stylesheet type=text/css href=qa.css /> </head> <body> <div id=wrap></div> </body>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.