title: Convert unicode characters to utf-8 in python
body: <p>Can someone tell me how to convert unicode characters to utf-8 in python ?</p>
  
  <p>For example :</p>
  
  <p><strong>Input</strong> - अ अ घ ꗄ </p>
  
  <p><strong>Output</strong> - E0A485 E0A485 E0A498 EA9784</p>
  
  <p>I tried the following method in python console :</p>
  
  <blockquote>
    <blockquote>
      <p><em>python-prompt</em>>>> character = "अ"</p>
      
      <p><em>python-prompt</em>>>> character</p>
      
      <p><em>python-prompt</em>>>> '\xe0\xa4\x85'</p>
    </blockquote>
  </blockquote>
  
  <p>In the above example if I simply print the variable "character" in console, I will get '\xe0\xa4\x85' as output. But I need the output in the form of E0A485. In short , the output I got '\xe0\xa4\x85' has 3 '\x' escape characters. How can I get rid of these '\x's ? So that my output is just e0a485 or E0A485 </p>