Split a string into a list with parts of N characters [duplicate]
问题 This question already has answers here : How do you split a list into evenly sized chunks? (63 answers) Closed 4 years ago . I'm very new to python and was wondering what the most pythonic/easy way is to split a string into a list with parts of N characters. I've come across this: >>>s = "foobar" >>>list(s) ['f', 'o', 'o', 'b', 'a', 'r'] which is how I can turn a string into a list of characters, but what I would want is to have a method that would look like this: >>>def splitInNSizedParts(s,