How to use 'python maketrans' in Python

Every line of 'python maketrans' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
174def maketrans(fromstr, tostr):
175 global _idmapL
176 if len(fromstr) != len(tostr):
177 raise ValueError, 'maketrans arguments must have same length'
178 if not _idmapL:
179 _idmapL = list(_idmap)
180 L = _idmapL[:]
181 fromstr = map(ord, fromstr)
182 for i in range(len(fromstr)):
183 L[fromstr[i]] = tostr[i]
184
185 return join(L, '')
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

60def maketrans(frm, to):
61 return ''

Related snippets