title: Unicode string Python
body: <p>I need to write to a file a string that contains the degree sign (°).</p>
  
  <p>This string is stored in variable and, as expected, when I try: <code>f.write(myVariable.encode('utf-8'))</code> I get UnicodeDecodeError.</p>
  
  <p>If I try to write this string to a file like:</p>
  
  <pre><code>x = u'aaa°°bbb'
  f.write(encode(x))
  </code></pre>
  
  <p>works fine, but I can't write <code>x = u'aaa°°bbb'</code> in my code because <code>'aaa°°bbb'</code> comes from a data base and it is stored in a variable and if I try <code>newVar = unicode(myVariable)</code> i get <code>UnicodeDecodeError</code>.</p>
  
  <p>I would need to pass myVariable to the 'u' python operator... How can I do this?</p>