So I have extracted data from a website and I need to save it in excel. I'm new to python and can't figure out how to go about it.
here is the data that I've extracted and it's type is bs4.beautifulsoup
{"lookbook":{"img":[],"count":0},"sizeInfoDes":{"sizeInfo":[{"size":"XS","Shoulder ":" 53 cm","Bust ":" 95 cm","Length ":" 51.5 cm","Sleeve Length ":" 49.5 cm"},{"size":"S","Shoulder ":" 55 cm","Bust ":" 99 cm","Length ":" 52.5 cm","Sleeve Length ":" 50 cm"},{"size":"M","Shoulder ":" 57 cm","Bust ":" 103 cm","Length ":" 53.5 cm","Sleeve Length ":" 50.5 cm"},{"size":"L","Shoulder ":" 60 cm","Bust ":" 109 cm","Length ":" 55 cm","Sleeve Length ":" 51 cm"},{"size":"XL","Shoulder ":" 63 cm","Bust ":" 115 cm","Length ":" 56.5 cm","Sleeve Length ":" 51.5 cm"}],"sizeInfoInch":[{"size":"XS","Shoulder ":" 20.9 inch","Bust ":" 37.4 inch","Length ":" 20.3 inch","Sleeve Length ":" 19.5 inch"},{"size":"S","Shoulder ":" 21.7 inch","Bust ":" 39 inch","Length ":" 20.7 inch","Sleeve Length ":" 19.7 inch"},{"size":"M","Shoulder ":" 22.4 inch","Bust ":" 40.6 inch","Length ":" 21.1 inch","Sleeve Length ":" 19.9 inch"},{"size":"L","Shoulder ":" 23.6 inch","Bust ":" 42.9 inch","Length ":" 21.7 inch","Sleeve Length ":" 20.1 inch"},{"size":"XL","Shoulder ":" 24.8 inch","Bust ":" 45.3 inch","Length ":" 22.2 inch","Sleeve Length ":" 20.3 inch"}],"sizeUnit":0,"allcmFlag":1,"sizeInfoAttribute":[],"basicAttribute":{"image_url":"","attribute_info":[],"base_code_info":[],"base_code_info_inch":[]}},"model":{"attr":{"Height":"175 cm","Bust":"85 cm","Waist":"61 cm","Hip":"93 cm"},"size":"S","name":"Andy","attrcm":{"Height":"175 cm","Bust":"85 cm","Waist":"61 cm","Hip":"93 cm"},"attrinch":{"Height":"68.9 inch","Bust":"33.5 inch","Waist":"24 inch","Hip":"36.6 inch"},"sizeUnit":0},"getTheLookInfo":[]}
I need shouder, bust, lenght and sleeve length values extracted.
Convert the data that you have into a
dictionary(it mostly looks like a json file, so u can easily convert it into a dictionary using thejsonmodule). Then, just use this code to output the data to an excel file:Output Screenshot:
Hope that this helps!