Say I have a string as:
mystr = "my name is some good name"
# I want to split at white space except for the part "name is"
expectedoutput = ["my", "name is", "some", "good", "name"]
How can I do it with and without shlex?
The way I was trying to do is:
Import shlex
def careful_split(inputstr, donot_split = "name is"):
strlex = shlex.shlex(inputstr, commenters =?, posit = ?)
strlex.wordchars = ?
#and other shlex function
return list(strlex)