Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Iterate through string in chunks in python

mystring = "backballbillbothbulkcastcarecase"

# Getting length of string 
chunksplit = 4
chunks = [mystring[i:i+chunksplit]
# Iterating through the string using rang
for i in range(0, len(mystring), chunksplit)]
# Print the new list consists of words of 4 character each
print(chunks)
Source by www.oraask.com #
 
PREVIOUS NEXT
Tagged: #Iterate #string #chunks #python
ADD COMMENT
Topic
Name
1+4 =