Source From Here
Question
As title, I want a function as below:
So I can use it this way:
HowTo
A simple implementation as below:
For example:
As title, I want a function as below:
- def split_text_into_n_chuck(text, n=2):
- pass
HowTo
A simple implementation as below:
- def split_text_into_n_chuck(text, n=2):
- return [text[i:i+n] for i in range(0, len(text), n)]
沒有留言:
張貼留言