user8931810
user8931810

Reputation:

Multiple urls in 1 url

I want to use multiple urls, but in stead of typing them all like I did below, I want to write a code that automatically +1's the last number in the url until the end of the month. Is that possible?

eventurl = "http://data.hisparc.nl/show/source/eventtime/501/2017/1/1/"
eventurl2 = "http://data.hisparc.nl/show/source/eventtime/501/2017/1/2/"
eventurl3 = "http://data.hisparc.nl/show/source/eventtime/501/2017/1/3/"

Upvotes: 0

Views: 94

Answers (2)

user8931810
user8931810

Reputation:

This works!

eventurl = "http://data.hisparc.nl/show/source/eventtime/501/2017/1/"
for dag in range(1, 32): 
    print(eventurl + str(dag))

(dag = day in Dutch)

Upvotes: 0

Ron
Ron

Reputation: 187

You are probably looking for something called the for loop try this code snippets

base_url = "http://data.hisparc.nl/show/source/eventtime/501/2017/1/{}/"
number_of_days_in_month = 30
for i in range(number_of_days_in_month):
    print(base_url.format(i+1))

Upvotes: 1

Related Questions