About 176,000 results
Open links in new tab
  1. python - How to split elements of a list? - Stack Overflow

    So i.split('\t', 1) calls the split() method of strings. Per the documentation, the first parameter of this method is the string to split by and the second is the maximum number of splits to perform. …

  2. python - Split list into smaller lists (split in half) - Stack Overflow

    Apr 15, 2009 · While the answers above are more or less correct, you may run into trouble if the size of your array isn't divisible by 2, as the result of a / 2, a being odd, is a float in python 3.0, …

  3. python - How can I partition (split up, divide) a list based on a ...

    I landed here looking for a list equivalent of str.split(), to split the list into an ordered collection of consecutive sub-lists. E.g. split([1,2,3,4,5,3,6], 3) -> ([1,2],[4,5],[6]), as opposed to dividing a …

  4. python - How do I split a list into equally-sized chunks ... - Stack ...

    Sep 29, 2016 · Python split list into n chunks. 8. Split list into separate but overlapping chunks. 1. How to Split or ...

  5. python - How to split a list of lists - Stack Overflow

    Mar 12, 2017 · So I want to split a list of lists. the code is myList = [['Sam has an apple,5,May 5'],['Amy has a pie,6,Mar 3'],['Yoo has a Football, 5 ,April 3']] I tried use this: for i in mylist: i.split...

  6. python - Splitting a list into N parts of approximately equal length ...

    Jan 25, 2010 · The other solutions seem to be a bit long. Here is a one-liner using list comprehension and the NumPy function array_split. array_split(list, n) will simply split the list …

  7. python - Slicing a list into a list of sub-lists - Stack Overflow

    You could use numpy's array_split function e.g., np.array_split(np.array(data), 20) to split into 20 nearly equal size chunks. To make sure chunks are exactly equal in size use np.split . – Alex

  8. How to split list and pass them as separate parameter?

    Split list in python. 1. Splitting a python list into multiple lists. 26. Split list into different ...

  9. python - Split a list into sub-lists based on index ranges - Stack …

    How do I split a list into sub-lists based on index ranges? e.g. original list: list1 = [x,y,z,a,b,c,d,e,f,g] using index ranges 0–4: list1a = [x,y,z,a,b] using index ranges 5–9: list1b = …

  10. python - How to to split a list at a certain value - Stack Overflow

    May 30, 2015 · Here is a function that will split a list into an arbitrary number of sub-lists and return a list of them, much like a string split. def split_list(input_list,seperator): outer = [] inner = …

Refresh