Apr-18-2020, 05:13 PM
After scrapping the website everything works like expected here is the code
#!/usr/bin/python import urllib2 from bs4 import BeautifulSoup website = ("http://www.ahajokes.com/ym01.html") page = urllib2.urlopen(website) soup = BeautifulSoup(page,'html.parser') yomama = soup.find(id="Joke_box") name = yomama.text.strip() print (name)Output
Yo mama so fat God told her he had no room in heaven and the devil said there was no room in hell (Submitted by )Yo Mama so fat her BMI is measured in acres. (Submitted by )Yo Mama so fat when she went to the movies she sat next to everyone (Submitted by )Yo mama so fat when her beeper goes off, people thought she was backing upYo mama so fat her nickname is "Lardo"What i want is after it finds the word "(Submitted by )" it should exclude that and include a new line instead of "(Submitted by )" how can i achieve this?