Creating JSON file in Python

preview_player
Показать описание
JSON File in Python
Рекомендации по теме
Комментарии
Автор

helped me with putting web scraped data into a json file, thank you for helping!

havenurmom
Автор

Well done, clear, concise and really helpful! Thanks a lot!

marindraganov
Автор

I bought python course and him in this course can't learn json, he put code element and never translated how it's worked. But i watched you video and i learn it's to perfect. (I'm from Poland) =>

adamacyLive
Автор

you can use the json.dump() method to write the json dict directly to file instead of using the s. for example:

with open('person.txt', 'w') as json_file:
json.dump(person, json_file)


here I replaced f with json_file (f works fine) and the person.txt file will be created if it does not already exist in the same dir of your python file > no need to type dir unless you want to move the file.


Thank you for the video. I hope this helps.

JR-wfvn
Автор

If we already save filed and then we not write
With open ("d:\\data.txt"")
Print(s)


This is not write then output will be comes no error

Banjara_boys_and_girl
Автор

can you explain why did you give "as f:" in the method?

snehanandimandalam