G
GrelEns
hello,
i'm looking for a pythonic and obvious way to do the following :
having a string space separated like : s = "w1 w2 w3 w4 w5 w6 w7 w8..."
how to get : l = (('w1', 'w2', 'w3'), ('w4', 'w5', 'w6'), ('w7', 'w8', ...),
....) ?
(a kind of splitting and grouping in an elegant way)
i think that list comprehension or "zip" could maybe help but i just can't
get it work,
thanks.
i'm looking for a pythonic and obvious way to do the following :
having a string space separated like : s = "w1 w2 w3 w4 w5 w6 w7 w8..."
how to get : l = (('w1', 'w2', 'w3'), ('w4', 'w5', 'w6'), ('w7', 'w8', ...),
....) ?
(a kind of splitting and grouping in an elegant way)
i think that list comprehension or "zip" could maybe help but i just can't
get it work,
thanks.