Issue
how can i do a loop of requests with id range 1 until 10 and storage them with append in a list for each result? Example
r1 = requests.get("https://test.net/api?id=1") # orange
r2 = request.get("https://test.net/api?id=2")... # apple
rn= request.get("https://test.net/api?id=n") # banana
final result
list = [ orange, apple, ... , banana]`
Solution
list = []
for x in range(10):
list.append(requests.get("https://test.net/api?id=" + str(x))
If your ids are one-based instead of zero-based you should do range(1,11) instead.
Answered By - spiderduckpig
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.