擅长:python、mysql、java
<p>在Python 2.6中,<code>maketrans</code>在<a href="http://docs.python.org/library/string.html#string.maketrans" rel="noreferrer">the string module</a>中。与Python2.7相同。</p>
<p>所以,你应该先使用<code>import string</code>,然后再使用<code>string.maketrans</code>,而不是<code>str.maketrans</code>。</p>