title: How to remove '\x' from a hex string in Python?
body: <p>I'm reading a <code>wav</code> audio file in Python using <code>wave</code> module. The <code>readframe()</code> function in this library returns frames as hex string. I want to remove <code>\x</code> of this string, but <code>translate()</code> function doesn't work as I want:</p>
  
  <pre><code>&gt;&gt;&gt; input = wave.open(r"G:\Workspace\wav\1.wav",'r')
  &gt;&gt;&gt; input.readframes (1)
  '\xff\x1f\x00\xe8'
  &gt;&gt;&gt; '\xff\x1f\x00\xe8'.translate(None,'\\x')
  '\xff\x1f\x00\xe8'
  &gt;&gt;&gt; '\xff\x1f\x00\xe8'.translate(None,'\x')
  ValueError: invalid \x escape
  &gt;&gt;&gt; '\xff\x1f\x00\xe8'.translate(None,r'\x')
  '\xff\x1f\x00\xe8'
  &gt;&gt;&gt; 
  </code></pre>
  
  <p>Any way I want divide the result values by 2 and then add <code>\x</code> again and generate a new <code>wav</code> file containing these new values. Does any one have any better idea?</p>
  
  <p>What's wrong?</p>