<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ## 基于json實現類的實例化 ``` #!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @File : garbage_test.py @Time : 2019/06/15 08:26:17 @Author : California Fruit @Desc : None ''' import json class Student(object): def __init__(self, name, age, score,reward): self.name = name self.age = age self.score = score self.reward = reward def json_2str(): data_json = {'name':'nick', 'age':12} json_str = json.dumps(data_json) print type(json_str), json_str def str_2json(): json_str = '{"age": 12, "name": "nick"}' json_class = json.loads(json_str) print type(json_class), json_class def class_2jsonStr(): stu = Student('Bob', 20, 88,["三好學生","優秀團干","最佳辯手"]) print json.dumps(obj=stu.__dict__,ensure_ascii=False) def jsonStr_2class(): def dict2student(d): return Student(d['name'], d['age'], d['score'],d['reward']) json_str = '{"name": "Bob", "age": 20, "score": 88, "reward": ["三好學生", "優秀團干", "最佳辯手"]}' student = json.loads(json_str,object_hook=dict2student) print(type(student)) print(student.name) if __name__ == "__main__": jsonStr_2class() ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看