As given in the dataset ID’s we have to extract the jokes upto ID number 499. So i want to know that how can we put a limit on the number of id’s. So please help with it.
How to limit the number of id's in http://api.icndb.com/jokes
hey @Varunsh_20 ,
you might have been provided with a test.csv file , so you just need to iterate over that file and read ids and extract jokes based on them.
I hope this would have resolved your doubt.
Thank You and Happy Learning .
Thank you Prashant Sir, for addressing my query. However, my issue is to select all jokes upto 499 id in Json and update upto 499 id only in csv file. This means selecting jokes with id till 499.
Hey @Varunsh_20, in the challenge you have to extract the jokes only for the ids listed in the ID.csv file. Apart from the challenge if you still want to extract jokes upto 499 only then you can do something like this :
jokes = []
for i in range(1,500):
collect = requests.get(url+'/'+str(i))
json_joke = json.loads(collect.content)
joke = json_joke['value']['joke']
jokes.append(joke)
Hope now you understand !
Happy Learning