Skip to content

Output of python code is incorrect #3224

@rchiodo

Description

@rchiodo

Run this code:

import urllib3
from bs4 import BeautifulSoup

def getAllDoxyDonkeyPosts(url, links):
    http = urllib3.PoolManager()
    page = http.request('GET', url)
    soup = BeautifulSoup(page.data)
    for a in soup.find_all('a'):
        try:
            url = a['href']
            title = a['title']
            if (title == "Older Posts"):
                print(title, url)
                links.append(url)
                getAllDoxyDonkeyPosts(url, links)
        except:
            title = ""
    return


blogUrl = "http://doxydonkey.blogspot.in"
links = []
getAllDoxyDonkeyPosts(blogUrl, links)

The expected output should print 'older posts=blahblah' per line. It ends up concatenating it per line.

We likely need to stick a line feed on our output concatenation.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions