Answers for "Iterate through string in chunks in python"

0

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)
Posted by: Guest on March-05-2022

Code answers related to "Iterate through string in chunks in python"

Python Answers by Framework

Browse Popular Code Answers by Language