title: Expected string or buffer (in re.sub)
body: <p>I <strong><em>have</em></strong> seen similar questions (<a href="https://stackoverflow.com/questions/16193521/typeerror-expected-string-or-buffer">here</a>, <a href="https://stackoverflow.com/questions/17365893/python-typeerror-expected-string-or-buffer">here</a>) before on SO and I know that <code>re.sub</code> expects a string (which, I believe, I am providing) but I don't know what's wrong in the following code:</p>
  
  <pre><code>tuples = re.findall(r'id":"(.*?)".*?name":"(.*?)"', response.text, re.DOTALL)
  outfile = open("badEXtsWithIDs.csv", "wb")
  print "Writing into CSV"
  writer = csv.writer(outfile)
  for entry in tuples:
      writeName = re.sub(r'\W', " ", entry)
      writer.writerow(writeName)
  </code></pre>
  
  <p>I think that <code>re.sub</code> needs a <code>str</code> variable but, isn't entry a <code>str</code>? I get a error: <code>TypeError: expected string or buffer</code> on the line having<code>re.sub</code>. Any help appreciated.</p>