What is
Please describe in words what you want to do and post some example data.
One very non-pythonic pattern is:
Better is:
And if you just to repeat something, where index and the element is not needed:
ft
, nt
, alb
, filezto
?Please describe in words what you want to do and post some example data.
One very non-pythonic pattern is:
for x in range(len(sequence))
Better is:
for index, element in enumerate(sequence): print(index, element)And if element is not required:
for index, _ in enumerate(sequence): print(index, element)The
_
is a throw away name (variable).And if you just to repeat something, where index and the element is not needed:
for _ in range(len(sequence)) print("Working...")I like more the
enumerate
-solution. Looks nicer. Lesser parenthesis.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!