gry@ll.mit.edu wrote:
> I have a string like:
>  {'the','dog\'s','bite'}
> or maybe:
>  {'the'}
> or sometimes:
>  {}
...
> I want to end up with a python array of strings like:
> 
> ['the', "dog's", 'bite']

Assuming that you trust the input, you could always use eval,
but since it seems fairly easy to solve anyway, that might
not be the best (at least not safest) solution.

 >>> strings = [r'''{'the','dog\'s','bite'}''', '''{'the'}''', '''{}''']
 >>> for s in strings:
...     print eval('['+s[1:-1]+']')
...
['the', "dog's", 'bite']
['the']
[]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to