Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

split string into array every n characters python

string = '1234567890'
n = 2	# every 2 characters
split_string = [string[i:i+n] for i in range(0, len(string), n)]
# split_string = ['12', '34', '56', '78', '90']
Comment

PREVIOUS NEXT
Code Example
Python :: download pdf from url python 
Python :: get current date in python 
Python :: how to take list of integer as input in python 
Python :: hide root window tkinter 
Python :: pandas tuple from two columns 
Python :: pandas rename index 
Python :: animations text terminal python 
Python :: create guid python 
Python :: clear screen python 
Python :: how to check in which directory python in running 
Python :: plus or minus symbol 
Python :: pandas add index 
Python :: python3 install google 
Python :: decimal places django template 
Python :: Drop Rows by Index in dataframe 
Python :: how to get just the filename in python 
Python :: plot roc curve for neural network keras 
Python :: get last column pandas 
Python :: install pipenv on windows 
Python :: matplotlib marker hollow circle 
Python :: pandas replace nonetype with empty string 
Python :: python file size 
Python :: dataframe copy 
Python :: python join array of ints 
Python :: how to open an external file in python 
Python :: how to clear a command line python 
Python :: pandas to csv without header 
Python :: matoplotlib set white background 
Python :: python how to find the highest number in a dictionary 
Python :: how to get input in tkinter 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =