[BangPypers] string to list query

Navin Kabra navin.kabra at gmail.com
Thu Aug 5 06:45:34 CEST 2010


On Thu, Aug 5, 2010 at 10:07 AM, Vikram K <kpguy1975 at gmail.com> wrote:

> Suppose i have this string:
> z = 'AT/CG'
>
> How do i get this list:
>
> zlist = ['A','T/C','G']
>

This is a very poorly specified question. And in absence of any information
about what exactly are the constraints on the input, and what is the
difficulty you're trying to overcome (and indeed no information about what
you tried already), I am going with the simplest solution:

zlist = [z[0:1], z[1:4], z[4:5]]

It looks like you're doing some DNA analysis, and I would guess that all
these strings will be 5 characters, I'm sure my solution will work fine.


More information about the BangPypers mailing list