从网页抓取文本 [英] Grabbing text from a webpage

查看:153
本文介绍了从网页抓取文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个程序,会发现公共汽车站次,并相应地更新我的个人网站。

I would like to write a program that will find bus stop times and update my personal webpage accordingly.

如果我是手动为此,我需要

If I were to do this manually I would


  1. 访问www.calgarytransit.com

  2. 输入停靠数。即)9510

  3. 单击按钮下一班车

的结果可能如下所示:

10:16P路由154
  10:46P路由154
  11:32P路线154

10:16p Route 154 10:46p Route 154 11:32p Route 154

一旦我抓住了时间和路线,然后我将相应地更新我的网页。

Once I've grabbed the time and routes then I will update my webpage accordingly.

我不知道从哪里开始。我知道网络编程diddly蹲,但可以写一些C和Python。什么是一些主题/库我可以看看?

I have no idea where to start. I know diddly squat about web programming but can write some C and Python. What are some topics/libraries I could look into?

推荐答案

美丽的汤是一个Python库设计解析网页。 IT之间和的urllib2 (的 urllib.request里在Python 3 ),你应该能够找出你所需要的。

Beautiful Soup is a Python library designed for parsing web pages. Between it and urllib2 (urllib.request in Python 3) you should be able to figure out what you need.

这篇关于从网页抓取文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆