Advertisement
surya_adi

wikipedia-parser.py

Jun 23rd, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. import urllib as u
  2. from bs4 import BeautifulSoup as b
  3. import os as o
  4.  
  5. class main():
  6.    
  7.     def __init__(self,url):
  8.         self.url = url
  9.         self.name = self.url.split('.')[1]
  10.         source = u.urlopen(self.url).read()
  11.         self.html = b(source,'html.parser').encode('utf-32')
  12.        
  13.     def soup(self):
  14.         print self.html.prettify()
  15.  
  16. main("http://www.wikipedia.org").soup()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement