About 5,340,000 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. How can I remove a key from a Python dictionary?

    One case where dict.pop() may be useful is if you want to create a new dictionary with the popped key-value pairs, effectively splitting a dictionary into two in one for-loop.

  3. python - How do I remove the first item from a list? - Stack Overflow

    Dec 13, 2010 · This solution (which has been around since Python 3.0) should definitively be preferred if you need both, head and tail. Do you perhaps have some additional information at …

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

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

  5. Can I use .pop() and .append() on the same item at the same time …

    Feb 23, 2012 · Can I use .pop () and .append () on the same item at the same time in Python? Asked 13 years, 8 months ago Modified 9 years, 10 months ago Viewed 33k times

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

    Jun 11, 2014 · Why? List iteration in Python essentially consists of an incrementing index into the list. When you delete an element you shift all the elements on the right over. This may cause …

  7. Python Remove last char from string and return it

    Mar 10, 2012 · Yes, python strings are immutable and any modification will result in creating a new string. This is how it's mostly done. So, go ahead with it.

  8. What is the time complexity of popping elements from list in …

    Oct 12, 2008 · I wonder what the time complexity of the pop method of list objects is in Python (in CPython particulary). Also does the value of N for list.pop(N) affect the complexity?

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

    Jun 16, 2014 · Are you using a collections.deque() object here instead of a list? Because that makes a huge difference from using the plain list type! There is no list.popleft() method, in the …

  10. python - What is the most pythonic way to pop a random element …

    Say I have a list x with unkown length from which I want to randomly pop one element so that the list does not contain the element afterwards. What is the most pythonic way to do this? I can …