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 8738167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:40:59+00:00 2026-06-13T10:40:59+00:00

Some html code contains some dt tags like follows: <dt>PLZ:</dt> <dd> 8047 </dd> I

  • 0

Some html code contains some dt tags like follows:

<dt>PLZ:</dt>
<dd>
8047
</dd>

I want to find the text in the dd tag following the dt tag with the text PLZ:. According to documentation I am trying the following:

number = BeautifulSoup(text).find("dt",text="PLZ:").findNextSiblings("dd")

with text the above string, but all I get is an empty list instead the number I am looking for (as string of course). Maybe I misunderstand the documentation?

  • 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-13T10:41:00+00:00Added an answer on June 13, 2026 at 10:41 am

    so just try:

    from BeautifulSoup import BeautifulSoup
    
    text = """
    <dt>PLZ:</dt>
    <dd>
    8047
    </dd>"""
    
    number = BeautifulSoup(text).find("dt",text="PLZ:").parent.findNextSiblings("dd")
    print BeautifulSoup(''.join(number[0]))
    

    or if you find with findNext try:

    number = BeautifulSoup(text).find("dt",text="PLZ:").parent.findNext("dd").contents[0]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

browsing some html code I find a text input coded as: <input type=text name=Email<%=orderRow.ID
I got some html text, which contains all kinds of html tags, such as
I have some HTML Code: <html> <head> <title>css test</title> <style type=text/css> .box{width:100%;float:left;background:red} </style> </head>
For the most part, when I want to display some HTML code to be
In a DIV I place some text/html code which get loaded from a database.
Robert C. Martin's book Clean Code contains the following: HTML in source code comments
I've got data in SQL Server 2005 that contains HTML tags and I'd like
I have some random HTML layouts that contain important text I would like to
I have a td-element which can contain some HTML code, e.g. &lt; . This
I'm writing some html code to make an html email. I've done some research

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.