About 24,000,000 results
Open links in new tab
  1. slice - How slicing in Python works - Stack Overflow

    The first way works for a list or a string; the second way only works for a list, because slice assignment isn't allowed for strings. Other than that I think the only difference is speed: it looks …

  2. Meaning of list[-1] in Python - Stack Overflow

    Sep 19, 2018 · I have a piece of code here that is supposed to return the least common element in a list of elements, ordered by commonality: def getSingle(arr): from collections import Counter c = …

  3. How to list all installed packages and their versions in Python?

    Jul 8, 2018 · Is there a way in Python to list all installed packages and their versions? I know I can go inside python/Lib/site-packages and see what files and directories exist, but I find this very …

  4. What is the difference between list and list [:] in python?

    Nov 2, 2010 · When reading, list is a reference to the original list, and list[:] shallow-copies the list. When assigning, list (re)binds the name and list[:] slice-assigns, replacing what was previously in …

  5. Kubernetes: list all pods and its nodes - Stack Overflow

    Nov 3, 2023 · I have 3 nodes, running all kinds of pods. I would like to have a list of nodes and pods, for an example: NODE1 POD1 NODE1 POD2 NODE2 POD3 NODE3 POD4 How can this please …

  6. python - How to convert list to string - Stack Overflow

    Apr 11, 2011 · How can I convert a list to a string using Python?

  7. What is the syntax to insert one list into another list in python?

    Sep 20, 2010 · What is the syntax to insert one list into another list in python? [duplicate] Asked 14 years, 10 months ago Modified 6 years, 1 month ago Viewed 349k times

  8. python - if/else in a list comprehension - Stack Overflow

    Since a list comprehension creates a list, it shouldn't be used if creating a list is not the goal; it shouldn't be used simply to write a one-line for-loop; so refrain from writing [print(x) for x in …

  9. Sorting a list with stream.sorted () in Java - Stack Overflow

    Sorted list: [20.455, 23.455, 24.455, 28.455] Are you sure you are not verifying list instead of sortedList [in above example] i.e. you are storing the result of stream() in a new List object and …

  10. Filter dataframe rows if value in column is in a set list of values

    Aug 22, 2012 · 134 isin() is ideal if you have a list of exact matches, but if you have a list of partial matches or substrings to look for, you can filter using the str.contains method and regular …