D
D
Dazai2021-07-05 17:23:28
Python
Dazai, 2021-07-05 17:23:28

How to turn a string into a list of numbers with 2 characters or more?

I have a line

Data = '37107287533902102798797998220837590246510135740250'

How to turn this string into a list of 2 characters, and in the future and more.
For example , or
some_list = [37,10,72 и тд]
some_list_two = [371,072,875 и тд ]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2021-07-05
@DazaiCoder

chunk_size = 3
arr = [ int(data[i:i + chunk_size]) for i in range(0, len(data), chunk_size) ]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question