Using a parser may sound like overkill, but why not when it's this easy? Get the latest pyparsing at http://pyparsing.sourceforge.net.
-- Paul from pyparsing import oneOf, Group, OneOrMore, Literal testdata = "ATT/GATA/G" marker = oneOf( "A T G C") SLASH = Literal("/").suppress() genDegenList = OneOrMore( Group( marker + SLASH + marker ) | Group( marker ) ) print genDegenList.parseString( testdata ) (prints: [['A'], ['T'], ['T', 'G'], ['A'], ['T'], ['A', 'G']] -- http://mail.python.org/mailman/listinfo/python-list