I have a basic Python Script which can store the output to a file. This is file is difficult to parse. Any other way to write scraped data to a file which can be read easily into Python for analysis ?
import requests
from bs4 import BeautifulSoup as BS
import json
data='C:/test.json'
url="http://sfbay.craigslist.org/search/sby/sss?sort=rel&query=baby"
r=requests.get(url)
soup=BS(r.content)
links=soup.find_all("p")
#print soup.prettify()
for link in links:
connections=link.text
f=open(data,'a')
f.write(json.dumps(connections,indent=1))
f.close()
Output File contains this: " $25 Sep 5 Porcelain Baby Deer $25 (sunnyvale) pic household items - by owner "" $7500 Sep 5 GEORGE STECK BABY GRAND PLAYER PIANO $7500 (morgan hill) map musical instruments - by