Python-维基百科自动下载器
[使用Python 3.1] 有谁知道如何使Python 3应用程序允许用户编写一个文本文件,其中包含多个用逗号分隔的单词。该程序应该读取该文件,并下载所请求项目的维基百科页面。例如,如果他们输入 hello,python-3,chicken ,它将转到维基百科并下载 http://www.wikipedia .com/wiki/hello、http://www.wikip...任何人都认为他们可以做到这一点?
当我说“下载”时,我的意思是下载文本,与图像无关。
[Using Python 3.1] Does anyone have any idea how to make a Python 3 application allow the user to write a text file with multiple words separated with commas. The program should read the file, and download the Wikipedia page of the requested item. e.g. if they typed hello,python-3,chicken it would go to Wikipedia and download http://www.wikipedia.com/wiki/hello, http://www.wikip... Anyone think they can do this?
When I say "download" I mean download the text, doesn't matter about images.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
查找
urllib.request
。Look up
urllib.request
.您准确地描述了如何制作这样一个程序。那么问题是什么?
您阅读该文件,用逗号分隔,然后下载 URL。完毕!
You described exactly how to make such a program. So what is the question?
You read the file, split on commas, and download the URL. Done!
检查下面的代码,它下载 html,没有图像,但您可以从正在解析的 xml 文件中访问它们以获取 url。
Check the following code, it downloads the html, without the images, but you can access them from the xml file that is being parsed to get the url.