Closed goldalworming closed 13 years ago
tofile() receives a file-like object, not a str, so you can do:
with open('templates.json', 'w') as f:
s.tofile(f)
Also, Scraper constructor receives a list of templates, so you should use the alternative fromfile() constructor when loading from a file:
with open('templates.json') as f:
s = Scraper.fromfile(f)
I test scrapely with your example...but I don't know how to store templates to file (or database)... I tried
so I test
what should I do to store template to file (or database) then use it again?? maybe redis is my database choice...