juliomalegria / python-craigslist

Simple Craigslist wrapper
MIT No Attribution
387 stars 117 forks source link

Save print result to data set #36

Closed SophiaJia closed 7 years ago

SophiaJia commented 7 years ago

Hi @juliomalegria , How can I save the result in to a data format, that I can output the data?

thanks Sophia

juliomalegria commented 7 years ago

Hi Sophia, Not sure if I understand your question. The method get_results returns an iterator of all the results. You can then save those results in whatever data format, like for example, JSON. Here an example:

import json
import craigslist

# ...
for result in cl_h.get_results(...):
    # Dump result (dictionary) into a JSON object and do something with it
    json.dumps(result)  # ...

Let me know if this answers your question.