Python help extract content webpage

0 ABHISHEK FRANCIS · April 17, 2015
import requests
from bs4 import BeautifulSoup
r=requests.get("http://en.wikipedia.org/wiki/Guitar")

soup1=BeautifulSoup(r.content)
fob = open('C:\\Python27\\SAM\\f.txt','w')


text = soup1.getText()
asciistring = text.encode("ascii","ignore")
print type(asciistring)
list= asciistring
#code here
#help code to write in a file
#suggest me any other way to use get.text() properly
#or to extract contents from webpage (every text from webpage)

print (list)
fob.close



Post a Reply

Replies

Oldest  Newest  Rating
0 Juan Grasso · April 17, 2015
What problem do you have? an error? what?
  • 1

Python

107,136 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator