About 81,900 results
Open links in new tab
  1. Difference between del, remove, and pop on lists in Python

    Related post on similar lines for set data structure - Runtime difference between set.discard and set.remove methods in Python?

  2. pop function in Python - Stack Overflow

    The argument passed to pop function works as an index. So instead of popping the element with the value of 1, it pops the element at the index 1 which is the second element of the list.

  3. Python pop() vs pop(0) - Stack Overflow

    Jun 11, 2014 · ubuntu-vm:~/sandbox$ ./test.py [0, 0, 0, 1, 2, 3] [0, 1, 2, 3, 4, 5, 6] Perhaps, I'm fundamentally misunderstanding how pop is implemented. But my understanding is ...

  4. python - Pop multiple items from the beginning and end of a list ...

    Jun 16, 2014 · Pop multiple items from the beginning and end of a list Asked 11 years, 5 months ago Modified 1 year ago Viewed 214k times

  5. pop/remove items out of a python tuple - Stack Overflow

    I have a tuple in python which I go through as follows (see code below). While going through it, I maintain a counter (let's call it 'n') and 'pop' items that meet a certain condition.

  6. python - Equivalent for pop on strings - Stack Overflow

    Jun 15, 2012 · Equivalent for pop on strings Asked 13 years, 5 months ago Modified 6 years, 3 months ago Viewed 86k times

  7. list - How do I retrieve the returned value when using the pop ...

    Jul 17, 2020 · You can retrieve the value returned by pop by doing popped=li.pop() where li is the list and the popped value is stored in popped. By default this pops the last item in the list.

  8. Problem when use pop () to remove more than one items

    Sep 4, 2018 · as result, it just pop function [9], but function [11] still exist Why does it happen and how to remove both function [9] and function [11]? PS: I have to do it in this way, not simply …

  9. python - Pop () not return any value when inside a function?

    Dec 6, 2020 · However, why does it not return the pop() value? Shouldn't it return 4 since the pop() function inside the solution() has a pop() function which, in definition, returns the value of …

  10. Popping items from a list using a loop in Python [duplicate]

    I'm trying to write a for loop in python to pop out all the items in a list but two, so I tried this: