Skip to content Skip to sidebar Skip to footer

Python URL Stepping Returns Only First Page Results

Any help with the below code would be appreciated. I have checked the results of h and g using print to verify that they are incrementing the url properly, but the program seems to

Solution 1:

I derived a minimal working example (no lengthy code possible in comment section..)

g = 'http://www.somesite.com/pg'
PageCount = 1

while PageCount < 3:
    h = g + str(PageCount)

    print h

    PageCount += 1

which is working just fine. The output is

http://www.somesite.com/pg1
http://www.somesite.com/pg2

Is this what you get? If so, try calling urllib2.urlopen([URL]) with a fixed url to check proper function in a separate minimal working example and go from there. Otherwise I see no error (or sources of error) that may cause such a behaviour.


Post a Comment for "Python URL Stepping Returns Only First Page Results"