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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:38:21+00:00 2026-06-18T12:38:21+00:00

I am trying to pull list of data from website using Beautiful Soup: class

  • 0

I am trying to pull list of data from website using Beautiful Soup:

class burger(webapp2.RequestHandler):
    Husam = urlopen('http://www.qaym.com/city/77/category/3/%D8%A7%D9%84%D8%AE%D8%A8%D8%B1/%D8%A8%D8%B1%D8%AC%D8%B1/').read()

    def get(self, soup = BeautifulSoup(Husam)):

        tago = soup.find_all("a", class_ = "bigger floatholder")
        for tag in tago:
        me2 = tag.get_text("\n")

        template_values = {
                           'me2': me2
                           }
        for template in template_values:

            template = jinja_environment.get_template('index.html')
            self.response.out.write(template.render(template_values))

Now when I try to show the data in template using jinja2, but it’s repeat the whole template based on the number of list and put each single info in one template.

How I put the the whole list in one tag and be able to edit other tags whith out repeating?

<li>{{ me2}}</li>
  • 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-18T12:38:22+00:00Added an answer on June 18, 2026 at 12:38 pm

    To output a list of entries, you can loop over them in your jinja2 template like this:

    {%for entry in me2%}
      <li> {{entry}} </li>
    {% endfor %}
    

    To use this, your python code also has to put the tags into a list.

    Something like this should work:

       def get(self, soup=BeautifulSoup(Husam)):
          tago = soup.find_all("a", class_="bigger floatholder")
    
          # Create a list to store your entries
          values = []
    
          for tag in tago:
              me2 = tag.get_text("\n")
              # Append each tag to the list
              values.append(me2)
    
          template = jinja_environment.get_template('index.html')
    
          # Put the list of values into a dict entry for jinja2 to use
          template_values = {'me2': values}
    
          # Render the template with the dict that contains the list
          self.response.out.write(template.render(template_values))
    

    References:

    • Jinja2 template documentation
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can't seem to pull ordered data from the database. I'm trying to list
I'm trying to pull in an element from an external website using PHP and
I'm using the Angel list api to pull this data and trying to parse
I'm trying to pull out a list of table names from a MySQL database.
I'm trying to pull data from the YouTube API into a local MySQL table.
I'm trying to pull some data out of logs on remote machines using awk,
I am trying to pull an LDAP jpegPhoto attribute from an openLDAP server using
I am trying to pull data from SQL, and then write it to a
I'm trying to pull data from the last row inserted (_id) of a database.
I am retrieving data from a database and trying to populate a List<>. That

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.