I have trouble loading a json file with the PyScripter editor

21 views
Skip to first unread message

REMI GNAMIEN

unread,
Apr 9, 2022, 7:43:52 AMApr 9
to PyScripter
Here is the code I wrote:
class Employe:
    def _init_(self, data_employe):
        for attr_name, attr_value in  data_employe.items():
            setattr(self, attr_name, attr_value)
        for  data_employe in json.load(open("data.json")):
            employe=Employe( data_employe)
            print(employe.profession)

When I run it, it returns nothing, i need help, please

Jadranko Belusic

unread,
Apr 10, 2022, 3:40:42 AMApr 10
to pyscr...@googlegroups.com
init method is with two underscores  __init__ not _init_
Jadranko Belušić
https://www.linkedin.com/in/jadranko-belu%C5%A1i%C4%87-818231176/


--
You received this message because you are subscribed to the Google Groups "PyScripter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyscripter+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyscripter/ae0e82c6-2088-486a-95fc-0437a2b6184bn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages