title: How come string.maketrans does not work in Python 3.1?
body: <p>I'm a Python newbie.</p>
  
  <p>How come <a href="http://www.tutorialspoint.com/python/string_maketrans.htm" rel="noreferrer">this</a> doesn't work in Python 3.1?</p>
  
  <pre><code>from string import maketrans   # Required to call maketrans function.
  
  intab = "aeiou"
  outtab = "12345"
  trantab = maketrans(intab, outtab)
  
  str = "this is string example....wow!!!";
  print str.translate(trantab);
  </code></pre>
  
  <p>When I executed the above code, I get the following instead:</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;pyshell#119&gt;", line 1, in &lt;module&gt;
      transtab = maketrans(intab, outtab)
    File "/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/string.py", line 60, in maketrans
      raise TypeError("maketrans arguments must be bytes objects")
  TypeError: maketrans arguments must be bytes objects
  </code></pre>
  
  <p>What does "must be bytes objects" mean? Could anyone please help post a working code for Python 3.1 if it's possible?</p>