title: Replacing a weird single-quote (’) with blank string in Python
body: <p>I'm trying to use <code>string.replace('’','')</code> to replace the dreaded weird single-quote character: ’ (aka \xe2 aka #8217). But when I run that line of code, I get this error:</p>
  
  <pre><code>SyntaxError: Non-ASCII character '\xe2' in file
  </code></pre>
  
  <p><strong>EDIT</strong>: I get this error when trying to replace characters in a CSV file obtained remotely.</p>
  
  <pre><code># encoding: utf-8
  
  import urllib2
  
  # read raw CSV data from URL
  url = urllib2.urlopen('http://www.aaphoenix.org/meetings/aa_meetings.csv')
  raw = url.read()
  
  # replace bad characters
  raw = raw.replace('’', "")
  
  print(raw)
  </code></pre>
  
  <p>Even after the above code is executed, the unwanted character still exists in the print result. I tried the suggestions in the below answers as well. Pretty sure it's an encoding issue, but I just don't know how to fix it, so of course any help is much appreciated.</p>