¡@

Home 

python Programming Glossary: num_str.split

python: convert “5,4,2,4,1,0” into [[5, 4], [2, 4], [1, 0]]

http://stackoverflow.com/questions/5083194/python-convert-5-4-2-4-1-0-into-5-4-2-4-1-0

num_str '5 4 2 4 1 0 3 0 5 1 3 3 14 32 3 5' zip iter num_str.split 2 '5' '4' '2' '4' '1' '0' '3' '0' '5' '1' '3' '3' '14' '32'.. the length of the sub elements to be different zip iter num_str.split 4 '5' '4' '2' '4' '1' '0' '3' '0' '5' '1' '3' '3' '14' '32'.. be lists wrap in a comprehension list t for t in zip iter num_str.split 4 '5' '4' '2' '4' '1' '0' '3' '0' '5' '1' '3' '3' '14' '32'..