On May 15, 11:12 am, xama...@yahoo.com wrote: > How do you parse a string enclosed in Curly Braces? > > For instance: > > x = "{ABC EFG IJK LMN OPQ}" > > I want to do x.split('{} ') and it does not work. Why does it not work > and what are EXCEPTIONS to using the split method? > > That I want to split based on '{', '}' and WHITESPACE. > > Please advise. > > Regards, > Xav
The reason it doesn't work is that you don't have a string with "{}". Instead, you have one of each. If your string was like this, then it would split: x = "{} ABC EFG" In the mean time, you can just use some string slicing like this: y = x[1:-1] That will remove the braces and allow you to manipulate the text therein. - Mike -- http://mail.python.org/mailman/listinfo/python-list