I want to split text into list, where file name with spaces should be treated as a single item: example
s = 'cmd -a -b -c "file with spaces.mp4" -e -f'.split()
print(s)
output:
['cmd', '-a', '-b', '-c', '"file', 'with', 'spaces.mp4"', '-e', '-f']
desired output:
['cmd', '-a', '-b', '-c', '"file with spaces.mp4"', '-e', '-f']
I tried using some for loops but it gets nasty, is there a decent way using regex or anything else which doesn't looks ugly