How to dump data from python as JSON -


I have a python program that can extract information from HTML files but I have to leave it as a JSON file.

is something like this:

  import import jsson bs4 import beautiful soup def main (): data = [] filename in glob.iglob ('* .html' ): F (s) as the open (filename): soup = beautiful soup (f) title = soup.find ("span", id = "btAsinTitle") data.appen D ({"title": title.get_text () , "Author": title.find_next ("a", href = true) .get_text (), "isbn": soup.find ('b', text = 'isben-10:'). Next_sibling, "weight": soup.fund ('b', text = 'shipping weight:'). Next-normal, "price": outf: json.dump as open ("my_output.json", "w") as soup.fank all ('span', {"class": 'bb_price'})}) (Data, outf) main ()    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -