基本上,我要做的是用python编写一个程序,它获取一个URL,复制源代码,并将所有注释提取出来并呈现给用户。在
import urllib2
import html2text
import PullsCommentsOut.pullscommentsout
url = raw_input('Please input URL with the text you want to analyze: ')
page = urllib2.urlopen(url)
html_content = page.read().decode('utf8')
rendered_content = html2text.html2text(html_content).encode('ascii',
'ignore')
f = open('file_text.txt', 'wb')
f.write(rendered_content)
f.close()
result = PullsCommentsOut.pullscommentsout(html_content)
print result
还有我的第二个文件“PullsCommentsOut”
^{pr2}$我一辈子都不明白为什么Python不认为我没有导入正确的模块?这没道理。在
我需要添加更多的文本,以便它允许我发帖,那么,你们都做得怎么样?我想我做得很好。没有抱怨。在
目前没有回答
相关问题 更多 >
编程相关推荐