I am a Python newbie :)
Given this code:
some_list_len = len(some_list)
for i in some_list_len :
print some_list[i]
Why do I get the warning in subject? How can I overcome that?
Best regards!
The type of some_list_len in your code is Int, so you get the warning.
If you want to iterate some_list_len, you can implement by this:
some_list_len = len(some_list)
for i in range(some_list_len) :
print some_list[i]
or directly use this:
for element in some_list :
···
and if you want to use indices, you can use enumerate:
for i, element in enumerate(some_list) :
···
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With