[Biopython-dev] test_AlignIO to python 3

Eric Talevich eric.talevich at gmail.com
Mon Jul 5 16:07:57 UTC 2010


2010/7/5 Tiago Antão <tiagoantao at gmail.com>

>
> 1. to test_Seq_objs.py add
>  import sys
> if sys.version_info[0] == 3:
>     maketrans = str.maketrans
> else:
>    from string import maketrans
>

You could skip importing sys by checking if the attribute is there on str:

if hasattr(str, 'maketrans'):
    maketrans = str.maketrans
else:
    from string import maketrans

-E




More information about the Biopython-dev mailing list