Re: String to sequence

2009-03-17 Thread Jeremiah Dodds
On Sat, Mar 14, 2009 at 9:09 AM, mattia wrote: > How can I convert the following string: > > 'AAR','ABZ','AGA','AHO','ALC','LEI','AOC', > EGC','SXF','BZR','BIQ','BLL','BHX','BLQ' > > into this sequence: > > ['AAR','ABZ','AGA','AHO','ALC','LEI','AOC', > EGC','SXF','BZR','BIQ','BLL','BHX','BLQ'] >

Re: String to sequence

2009-03-16 Thread S Arrowsmith
Peter Otten <__pete...@web.de> wrote: >assert s.startswith("[") >assert s.endswith("]") >s = s[1:-1] s.strip('[]') (I suppose it all depends on how much you can trust the consistency of the input.) -- \S under construction -- http://mail.python.org/mailman/listinfo/python-list

Re: String to sequence

2009-03-15 Thread mattia
Il Sat, 14 Mar 2009 15:30:29 -0500, Tim Chase ha scritto: >> How can I convert the following string: >> >> 'AAR','ABZ','AGA','AHO','ALC','LEI','AOC', >> EGC','SXF','BZR','BIQ','BLL','BHX','BLQ' >> >> into this sequence: >> >> ['AAR','ABZ','AGA','AHO','ALC','LEI','AOC', >> EGC','SXF','BZR','BIQ'

Re: String to sequence

2009-03-14 Thread Tim Chase
How can I convert the following string: 'AAR','ABZ','AGA','AHO','ALC','LEI','AOC', EGC','SXF','BZR','BIQ','BLL','BHX','BLQ' into this sequence: ['AAR','ABZ','AGA','AHO','ALC','LEI','AOC', EGC','SXF','BZR','BIQ','BLL','BHX','BLQ'] Though several other options have come through: >>> s = "'

Re: String to sequence

2009-03-14 Thread mattia
Il Sat, 14 Mar 2009 12:13:31 +0100, Peter Otten ha scritto: > mattia wrote: > >> Il Sat, 14 Mar 2009 10:35:59 +0100, Peter Otten ha scritto: >> >>> mattia wrote: >>> How can I convert the following string: 'AAR','ABZ','AGA','AHO','ALC','LEI','AOC', EGC','SXF','BZR','BIQ','B

Re: String to sequence

2009-03-14 Thread Peter Otten
mattia wrote: > Il Sat, 14 Mar 2009 10:35:59 +0100, Peter Otten ha scritto: > >> mattia wrote: >> >>> How can I convert the following string: >>> >>> 'AAR','ABZ','AGA','AHO','ALC','LEI','AOC', >>> EGC','SXF','BZR','BIQ','BLL','BHX','BLQ' >>> >>> into this sequence: >>> >>> ['AAR','ABZ','AGA',

Re: String to sequence

2009-03-14 Thread mattia
Il Sat, 14 Mar 2009 10:35:59 +0100, Peter Otten ha scritto: > mattia wrote: > >> How can I convert the following string: >> >> 'AAR','ABZ','AGA','AHO','ALC','LEI','AOC', >> EGC','SXF','BZR','BIQ','BLL','BHX','BLQ' >> >> into this sequence: >> >> ['AAR','ABZ','AGA','AHO','ALC','LEI','AOC', >> E

Re: String to sequence

2009-03-14 Thread Peter Otten
mattia wrote: > Il Sat, 14 Mar 2009 10:30:43 +0100, Vlastimil Brom ha scritto: > >> 2009/3/14 mattia : >>> How can I convert the following string: >>> >>> 'AAR','ABZ','AGA','AHO','ALC','LEI','AOC', >>> EGC','SXF','BZR','BIQ','BLL','BHX','BLQ' >>> >>> into this sequence: >>> >>> ['AAR','ABZ','AGA'

Re: String to sequence

2009-03-14 Thread Lie Ryan
mattia wrote: Il Sat, 14 Mar 2009 10:30:43 +0100, Vlastimil Brom ha scritto: 2009/3/14 mattia : How can I convert the following string: 'AAR','ABZ','AGA','AHO','ALC','LEI','AOC', EGC','SXF','BZR','BIQ','BLL','BHX','BLQ' into this sequence: ['AAR','ABZ','AGA','AHO','ALC','LEI','AOC', EGC','S

Re: String to sequence

2009-03-14 Thread mattia
Il Sat, 14 Mar 2009 10:30:43 +0100, Vlastimil Brom ha scritto: > 2009/3/14 mattia : >> How can I convert the following string: >> >> 'AAR','ABZ','AGA','AHO','ALC','LEI','AOC', >> EGC','SXF','BZR','BIQ','BLL','BHX','BLQ' >> >> into this sequence: >> >> ['AAR','ABZ','AGA','AHO','ALC','LEI','AOC', >>

Re: String to sequence

2009-03-14 Thread mattia
Il Sat, 14 Mar 2009 10:24:38 +0100, Ulrich Eckhardt ha scritto: > mattia wrote: >> How can I convert the following string: >> >> 'AAR','ABZ','AGA','AHO','ALC','LEI','AOC', >> EGC','SXF','BZR','BIQ','BLL','BHX','BLQ' >> >> into this sequence: >> >> ['AAR','ABZ','AGA','AHO','ALC','LEI','AOC', >>

Re: String to sequence

2009-03-14 Thread Peter Otten
mattia wrote: > How can I convert the following string: > > 'AAR','ABZ','AGA','AHO','ALC','LEI','AOC', > EGC','SXF','BZR','BIQ','BLL','BHX','BLQ' > > into this sequence: > > ['AAR','ABZ','AGA','AHO','ALC','LEI','AOC', > EGC','SXF','BZR','BIQ','BLL','BHX','BLQ'] >>> s = "'AAR','ABZ','AGA','AHO'

Re: String to sequence

2009-03-14 Thread Vlastimil Brom
2009/3/14 mattia : > How can I convert the following string: > > 'AAR','ABZ','AGA','AHO','ALC','LEI','AOC', > EGC','SXF','BZR','BIQ','BLL','BHX','BLQ' > > into this sequence: > > ['AAR','ABZ','AGA','AHO','ALC','LEI','AOC', > EGC','SXF','BZR','BIQ','BLL','BHX','BLQ'] > > Thanks a lot, > Mattia > --

Re: String to sequence

2009-03-14 Thread Ulrich Eckhardt
mattia wrote: > How can I convert the following string: > > 'AAR','ABZ','AGA','AHO','ALC','LEI','AOC', > EGC','SXF','BZR','BIQ','BLL','BHX','BLQ' > > into this sequence: > > ['AAR','ABZ','AGA','AHO','ALC','LEI','AOC', > EGC','SXF','BZR','BIQ','BLL','BHX','BLQ'] import string string.split("a,b,c

Re: String to sequence

2009-03-14 Thread Frank Pan
>>> a = eval("[%s]" % "'AAR','ABZ','AGA','AHO','ALC','LEI','AOC','EGC','SXF','BZR','BIQ','BLL','BHX','BLQ'") >>> a ['AAR', 'ABZ', 'AGA', 'AHO', 'ALC', 'LEI', 'AOC', 'EGC', 'SXF', 'BZR', 'BIQ', 'BLL', 'BHX', 'BLQ'] On Sat, Mar 14, 2009 at 5:09 PM, mattia wrote: > How can I convert the following

String to sequence

2009-03-14 Thread mattia
How can I convert the following string: 'AAR','ABZ','AGA','AHO','ALC','LEI','AOC', EGC','SXF','BZR','BIQ','BLL','BHX','BLQ' into this sequence: ['AAR','ABZ','AGA','AHO','ALC','LEI','AOC', EGC','SXF','BZR','BIQ','BLL','BHX','BLQ'] Thanks a lot, Mattia -- http://mail.python.org/mailman/listinfo