Splitting a list of strings

Terry Reedy tjreedy at udel.edu
Wed Sep 18 01:18:20 EDT 2002


"Sean Ross" <sross at connectmail.carleton.ca> wrote in message
news:am8pvo$dcn$1 at driftwood.ccs.carleton.ca...
> Okay. Here is some representative sample data:
> [snip]
> @attribute 'cap-shape' { 'b', 'c', 'f', 'k', 's', 'x'}
> [snip]
>
'x','s','n','t','p','f','c','n','k','e','e','s','s','w','w','p','w','o
','p',
> 'k','s','u','p'

Unless you plan to exec parts of the lines as if they were Python
code, I believe you would be better off without all the quotes.  You
could then split on ',' and have the 1-char strings you want..

Terry J. Reedy





More information about the Python-list mailing list