[Tutor] Retrieving data from a web site
Walter Prins
wprins at gmail.com
Sat May 18 19:48:53 CEST 2013
Hi
Just a minor observation:
On 18 May 2013 13:44, Peter Otten <__peter__ at web.de> wrote:
> Phil wrote:
>
> > On 18/05/13 19:25, Peter Otten wrote:
> >>
> >> Are there alternatives that give the number as plain text?
> >
> > Further investigation shows that the numbers are available if I view the
> > source of the page. So, all I have to do is parse the page and extract
> > the drawn numbers. I'm not sure, at the moment, how I might do that but
> > I have something to work with.
>
> You can use a tool like lxml that "understands" html (though in this case
> you'd need a javascript parser on top of that) -- or hack something
> together
> with string methods or regular expressions. For example:
You don't need javascript, in this case, assuming the reference is to the
UK lotto -- A simple curl test confirms that (for the UK lottery at least)
the numbers can be retrieved simply without the involvedment of javascript,
so Python will be able to do the same. (URL:
https://www.national-lottery.co.uk/player/p/results.ftl Apologies if this
is about some other lottery and I've missed it...)
Best,
Walter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130518/0c9d3ba9/attachment.html>
More information about the Tutor
mailing list