M
M
Mikhail Osin2018-09-25 17:44:43
Python
Mikhail Osin, 2018-09-25 17:44:43

How to build a loop with a range in python with a dynamically changing final value?

There is a function:

def keylist():
    for x in list(range(0,100)):
        print(furl.format((data["values"][x]["key"])))

I want to get rid of the error:
Traceback (most recent call last):
File "C:/[Python]/pt/func.py", line 28, in
keylist()
File "C:/[Python]/pt/func.py ", line 25, in keylist
print(furl.format((data["values"][x]["key"])))
IndexError: list index out of range
Tell me how to do it!?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question