我试图废弃网站的内容。然而,在输出中我得到了不需要的空间,因此我无法解释这个输出。我使用一个简单的代码:
import urllib2
from bs4 import BeautifulSoup
html= 'http://idlebrain.com/movie/archive/index.html'
soup = BeautifulSoup(urllib2.urlopen(html).read())
print(soup.prettify(formatter=None))
OUTPUT::(输出非常大,所以只占一小部分,以便了解我面临的问题)
<html><head><title>Telugu cinema reviews by Jeevi - idlebrain.com</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
</head><bodybgcolor="#FFFFFF" leftmargin="0" marginheight="0" marginwidth="0" topmargin="0"><table border="0" cellpadding="0" cellspacing="0" width="96%">
<tr>
<td align="left"> <img alt="Idlebrain.Com" height="63" src="../../image/vox_r01_c2.gif"width="264"/></td>
<td><div align="right"><script type="text/javascript"><!--
g o o g l e _ a d _ c l i e n t = " c a - p u b - 8 8 6 3 7 1 8 7 5 2 0 4 9 7 3 9 " ;
/ * r e v i e w s - h o r * /
g o o g l e _ a d _ s l o t = " 1 6 4 8 6 2 0 2 7 3 " ;
g o o g l e _ a d _ w i d t h = 7 2 8 ;
g o o g l e _ a d _ h e i g h t = 9 0 ;
/ / - - >
< / s c r i p t >
< s c r i p t t y p e = " t e x t / j a v a s c r i p t "
s r c = " h t t p : / / p a g e a d 2 . g o o g l e s y n d i c a t i o n . c o m / p a g e a d / s h o w _ a d s . j s " >
< / s c r i p t >
< / d i v >
< / t d >
< / t r >
< / t a b l e >
< t a b l e w i d t h = " 9 6 % " b o r d e r = " 0 " c e l l s p a c i n g = " 0 " c e l l p a d d i n g = " 0 " >
< t r >
< t d w i d t h = " 1 2 8 " v a l i g n = " t o p " a l i g n = " l e f t " >
< t a b l e b o r d e r = " 0 " c e l l p a d d i n g = " 0 " c e l l s p a c i n g = " 0 " w i d t h = " 1 1 9 " >
< / t r >
< / t a b l e >
< / b o d y >
< / h t m l >
</script></div></td></tr></table></body></html>
谢谢!!!!