문제

I want to cycle thru the dates at the bottom of the page using what looks like a form. But it is returning a blank. Here is my code.

import mechanize

URL='http://www.airchina.com.cn/www/jsp/airlines_operating_data/exlshow_en.jsp'

br = mechanize.Browser()
r=br.open(URL)

for form in br.forms(): #finding the name of the form
    print form.name
    print form

Why is this not returning any forms? it is not a form? if not, how do I control the year and month at the bottom to cycle thru the pages?

Can someone provide some sample code on how to do it?

도움이 되었습니까?

해결책

Trying to access that page what you are actually doing is being directed to an error page. Paste that url in a browser and you get a page with:

Not comply with the conditions of the inquiry data

and no forms at all

You need to access the page in a different way. I would suggest stepping throught the url directory until you find the right path.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top