Below answer from Navin if good one, to make it more complex :) you can use
>>> z 'AT/CG' >>> re.split('[A-Z]/[A-Z]',z) ['A', 'G'] >>> re.search('[A-Z]/[A-Z]',z).group() 'T/C' using these two you can get your answer On Thu, Aug 5, 2010 at 10:15 AM, Navin Kabra <navin.ka...@gmail.com> wrote: > On Thu, Aug 5, 2010 at 10:07 AM, 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'] > > > > 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. > _______________________________________________ > BangPypers mailing list > BangPypers@python.org > http://mail.python.org/mailman/listinfo/bangpypers > -- Nitin K _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers