Exact duplicate: http://stackoverflow.com/questions/79968/split-a-string-by-spaces-in-python
I want to take in a string and return a list, dictionary or tuple of values as separated by spaces. However, I want to not match spaces that are somehow between quote marks, i.e.
apple orange "banana tree" green
Should come back as three items, "banana tree" being one whole item.
If possible it should also allow for the escaping of quote marks.