NameError: name 'maketrans' is not defined - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: NameError: name 'maketrans' is not defined (/thread-4941.html) |
NameError: name 'maketrans' is not defined - rajeev1729 - Sep-13-2017 from string import maketrans intab = "aeiou" outtab = "12345" trantab = maketrans(intab, outtab) str = "this is string example....wow!!!" print (str.translate(trantab))Traceback (most recent call last): File "C:/Python 3.6/program/tran.py", line 3, in <module> trantab = maketrans(intab, outtab) NameError: name 'maketrans' is not defined RE: NameError: name 'maketrans' is not defined - nilamo - Sep-13-2017 maketrans is a method of str , not the string module.>>> print(str.maketrans) <built-in method maketrans of type object at 0x58ABB5A0> RE: NameError: name 'maketrans' is not defined - rajeev1729 - Sep-13-2017 thank you very much for your replies |