0

Suppose i have a string ci='SKDKFJKFLKG' and I want to store it in a matrix.I am using the following code to store it in a matrix:

def chunks(l, n):

    for i in range(0, len(l), n):
        yield l[i:i+n]
pprint.pprint(list(chunks(ci, 1)))

Output:

['S', 'K', 'D', 'K', 'F', 'J', 'K', 'F', 'L', 'K', 'G']

What should i do if i want only 4 characters in each row of the matrix?

lavish
  • 43
  • 6

0 Answers0