ich möchte in einem Text Buchstaben durch einen anderen ersetzen, damit der Text lesbar wird.
Folgendes Beispiel:
Code: Alles auswählen
#Miedo al Cambio
trans_table = str.maketrans(dict(a="s", b="t", c="u", d="e", e="d", m="i", n="o", o="n", s="a", u="c", t="b"))
input = "unnremosbda"
translated = input.translate(trans_table)
Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
Traceback (most recent call last):
File "C:/Python27/Programmtests/Miedo_al_Cambio.py", line 2, in <module>
trans_table = str.maketrans(dict(a="s", b="t", c="u", d="e", e="d", m="i", n="o", o="n", s="a", u="c", t="b"))
AttributeError: type object 'str' has no attribute 'maketrans'
>>>
Damit kann ich aber leider nichts anfangen.
Besten Dank für eine kleine Hilfe.