Answer the question
In order to leave comments, you need to log in
What is the correct way to access the elements of a list?
I had a misunderstanding with lists ...
There is a list:
testlist = ['1111',
'2222',
'3333',
'4444',
'5555']
while testlist:
for items in testlist:
print ('Беру элемент',items)
print ('Удаляю',testlist.pop(0))
time.sleep(15)
Беру элемент 1111
Удаляю 1111
Беру элемент 3333
Удаляю 2222
Беру элемент 5555
Удаляю 3333
Беру элемент 4444
Удаляю 4444
Беру элемент 5555
Удаляю 5555
Answer the question
In order to leave comments, you need to log in
Цикл for
здесь лишний.
while(testlist):
x = testlist.pop(0)
print('Беру элемент', x)
print('Удаляю', x)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question