Loop from 'aaaa' to 'tttt' ?

Steven Taschuk staschuk at telusplanet.net
Mon Jun 16 19:45:53 CEST 2003


Quoth Lars Schaps:
  [...]
> One idea i had is to take a number n with the base of
> 4 and use 
> 
> t= string.translate( '0123', 'acgt')
> string.translate( n, t)
> 
> But i don't know how to convert from base10 to base4.

There's a recipe in the Python Cookbook for base conversion:

    <http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65212>

-- 
Steven Taschuk             "The world will end if you get this wrong."
staschuk at telusplanet.net     -- "Typesetting Mathematics -- User's Guide",
                                 Brian Kernighan and Lorrinda Cherry





More information about the Python-list mailing list