Here's a slightly different approach
def splitter(input):
buffer = []
slash = False
for char in input :
if len(buffer) == 0 :
buffer.append(char)
elif char == '/' :
buffer.append(char)
slash = True
elif slash :
buffer.append(char)
slash = False
else :
yield "".join(buffer)
buffer = [char]
if len(buffer) > 0 :
yield "".join(buffer)
print tuple(splitter('AT/CG'))
On Thu, Aug 5, 2010 at 10:07 AM, Vikram K <[email protected]> wrote:
> Suppose i have this string:
> z = 'AT/CG'
>
> How do i get this list:
>
> zlist = ['A','T/C','G']
> _______________________________________________
> BangPypers mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/bangpypers
>
--
--------------------------------------------------------
blog: http://blog.dhananjaynene.com
twitter: http://twitter.com/dnene
_______________________________________________
BangPypers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/bangpypers