[Tutor] need idea
Andre Engels
andreengels at gmail.com
Thu Feb 11 00:24:10 CET 2010
On Thu, Feb 11, 2010 at 12:12 AM, invincible patriot
<invincible_patriot at hotmail.com> wrote:
> thanks
> let me clear you that what i am trying to do
> suppose we hav a input string and a dict
> our_dict={'a':'u', 't':'a', 'c':'g', 'g':'c'}
> input_string='atcg'
>
>
> now what i wana do is that where ever we are having 'a' i wana replace it
> with 'u', 't' with 'a' and so on
> i tried using input_string.replace('a', 'u')
> but it is replacing only one character
> i wana replace these 4 characters according to the dictionary
>
> i hope it is now clear
>
> kindly let me know how to proceed now
See http://www.tutorialspoint.com/python/string_translate.htm
--
André Engels, andreengels at gmail.com
More information about the Tutor
mailing list