title: How to encode and decode from spanish in python
body: <p>I have the following code written in python 2.7</p>
  
  <pre class="lang-python prettyprint-override"><code># -*- coding: utf-8 -*-    
  import sys
  
  _string = "años luz detrás"
  print _string.encode("utf-8")
  </code></pre>
  
  <p>this throws the following error:</p>
  
  <pre class="lang-python prettyprint-override"><code>print _string.encode("utf-8")
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)
  </code></pre>
  
  <p>Any help appreciated, thanks in advance</p>