Created
August 31, 2020 12:56
-
-
Save fddn/4beed74d1a331e600510681e7ba90d9a to your computer and use it in GitHub Desktop.
Revisions
-
fddn created this gist
Aug 31, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ { "data1": [ "data11", "data12" ], "data2": [ "data21", "data22" ] } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ import json class Data(object): def __init__(self): with open('data.json') as json_file: self.data = json.load(json_file) self.__dict__ = dict(self.data) if __name__ == "__main__": data = Data() print(data.data1) print(data.data2)