TypeError: argument 1 must be convertible to a buffer, not BeautifulSoup
<pre><code>from bs4 import BeautifulSoup
import requests
import csv


page=requests.get("http://www.gigantti.fi/catalog/tietokoneet/fi_kannettavat/kannettavat-tietokoneet")

data=BeautifulSoup(page.content)

h=open("test.csv","wb+")
h.write(data)
h.close()

print (data)
</code></pre>

<p>i have tried running the code as it is without printing it in csv file and it runs perfectly but the moment I try to save it in csv I get the error : argument 1 must be convertible to a buffer, not BeautifulSoup. PLEASE HELP and thanks in advance</p>

<p>I don't know whether someone was able to solve it or not but my hit and trial worked. the problem was I was not converting the content to string.</p>

<pre><code>#what i needed to add was:
#after line data=BeautifulSoup(page.content)
a=str(data)
</code></pre>

<p>Hopefully this helps</p>

python csv web-scraping