Either way to get your string output, do something like this:
','.join(breadcrum)
Solution 3:
Unless I'm missing something, just combine strip and list comprehension.
Code:
from bs4 import BeautifulSoup as bsoup
ofile = open("test.html", "r")
soup = bsoup(ofile)
res = ",".join([a.get_text().strip() for a in soup.find("div", class_="path").find_all("a")])
print res
Post a Comment for "Removing New Line '\n' From The Output Of Python BeautifulSoup"