On Thu, Aug 5, 2010 at 2:38 PM, Vikram K <kpguy1...@gmail.com> wrote:
> Suppose i have this string:
> z = 'AT/CG'
>
> How do i get this list:
>
> zlist = ['A','T/C','G']

>>> import re
>>> z = 'AT/CG'
>>> [x for x in re.split("([A-Z]\/[A-Z])|([A-Z])", z) if x]
['A', 'T/C', 'G']
>>>

cheers
James

-- 
-- James Mills
--
-- "Problems are solved by method"
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to