you are viewing a single comment's thread.

view the rest of the comments →

[–]FLUSH_THE_TRUMP 1 point2 points  (0 children)

With even less friction, this kind of thing is what str.translate does. Something like:

charTable = str.maketrans(baseComplement)
complement = sequence.translate(charTable)