Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

split a string into N equal parts.

your_string = [i for i in range(20)]
n= 5
parts = [your_string[i:i+n] for i in range(0, len(your_string), n)]
print(parts)
#[[0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19],]
Comment

PREVIOUS NEXT
Code Example
Python :: how to search in django 
Python :: python sort the values in a dictionaryi 
Python :: replace nan with 0 pandas 
Python :: python shuffle array 
Python :: remove tab space from string in python 
Python :: play video in colab 
Python :: dataframe in python 
Python :: sqlalchemy one to many 
Python :: entered_text_1 = textbox_1.get(1.0, tk.END+"-1c") 
Python :: custom position for axis matplotlib 
Python :: python cv2 imwrite 
Python :: iterate over classes in module python 
Python :: app is not a registered namespace django 
Python :: django deployment 
Python :: read a file python 
Python :: edit pandas row value 
Python :: timer 1hr 
Python :: view all columns pandas 
Python :: python integer to string 
Python :: python absolute path from projectr 
Python :: python practice 
Python :: python delete element from list 
Python :: seaborn Using the dark theme python 
Python :: how to make gtts text to speech converter 
Python :: iterate over dataframe 
Python :: how to write a code for anagram in python 
Python :: count occurrence in array python 
Python :: fibonacci series using recursion in python 
Python :: replace list python 
Python :: python compare sets 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =