title: chr(n) failed when n exceeds 256
body: <p>I am using <code>chr</code> and <code>int</code> to convert a binary representation string to real binary value.</p>
  
  <p>What I did is </p>
  
  <pre><code>   n=int('0101011',2)
     binary=chr(n)
  </code></pre>
  
  <p>Then <code>binary</code> is the real binary value of the representation string.</p>
  
  <p>But what if the string I gave to int is larger than 256 in decimal?</p>
  
  <p>Any solution?</p>
  
  <p><strong>PS:</strong>
  The reason I use chr is I want to convert <code>n</code> to a string so that I can write it to a file, using <code>f.write()</code>.</p>
  
  <p>And this question is originated from <a href="https://stackoverflow.com/questions/7213996/convert-binary-representation-string-to-binary-in-python/7214014#7214014">this question</a></p>