title: What does "table" in the string.translate function mean?
body: <p>Going through the <a href="http://docs.python.org/2/library/string.html#string.translate" rel="noreferrer"><code>string.translate</code></a> function which says:</p>
  
  <blockquote>
    <p>Delete all characters from s that are in deletechars (if present), and then translate the characters using table, which must be a 256-character string giving the translation for each character value, indexed by its ordinal. If table is None, then only the character deletion step is performed.</p>
  </blockquote>
  
  <ul>
  <li>What does <em>table</em> mean here? Can it be a <code>dict</code> containing the mapping?</li>
  <li>What does <em>"must be a 256-character string"</em> mean?</li>
  <li>Can the <em>table</em> be made manually or through a custom function instead of <code>string.maketrans</code>?</li>
  </ul>
  
  <p>I tried using the function (attempts below) just to see how it worked but wasn't successfully able to use it.</p>
  
  <pre><code>&gt;&gt;&gt; "abcabc".translate("abcabc",{ord("a"): "d", ord("c"): "x"})
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  ValueError: translation table must be 256 characters long
  </code></pre>
  
  
  
  <pre><code>&gt;&gt;&gt; "abcabc".translate({ord("a"): ord("d"), ord("c"): ord("x")}, "b")
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  TypeError: expected a character buffer object
  </code></pre>
  
  <p></p>
  
  <pre><code>&gt;&gt;&gt; "abc".translate({"a": "d", "c": "x"}, ["b"])
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  TypeError: expected a character buffer object
  </code></pre>
  
  <p>What am I missing here?</p>