In one specialized case when none of the list items contains one of the following delimiters []'
, you can use the following hack. I have not profiled it, but it looks obvious that, this would have a better performance than the obvious and cleaner recursive solution.
>>> str(list_of_menuitems).translate(None,"[]'").split(',')
['image10', ' image00', ' image01', ' image02', ' image03', ' image04']
I agree, this is a dirty hack, but does the JOB, without much effort.