GH avatar Bite 155. Split a string by spaces or quoted text

Another text manipulation Bite. Code split_words_and_quoted_text that takes a text string and splits it by space, except words that are wrapped between double quotes ("), these spaces needs to be preserved.

So passing it Should give "3 words only", it would return a list of 3 (not 5) elements: ['Should', 'give', '3 words only'] (note that the double quotes are stripped off as well).

Check out the standard library, there might be a tool for the job ;) - good luck and keep calm and code in Python!

Will you be Pythonista #33 to crack this Bite?
It takes an average of ~50 minutes to solve this Bite (submissions 5-240 min).
Pythonistas rate this Bite 3.0 on a 1-10 difficulty scale.
» You can do it! 😌

Buy Now Login and get coding
We use Python 3.7