I\'m trying to find the most pythonic way to split a string like
\"some words in a string\"
into single words. string.split(\' \')
string.split(\' \')
Just use my_str.split() without ' '.
' '
More, you can also indicate how many splits to perform by specifying the second parameter:
>>> ' 1 2 3 4 '.split(None, 2) ['1', '2', '3 4 '] >>> ' 1 2 3 4 '.split(None, 1) ['1', '2 3 4 ']