简体   繁体   中英

JSON-like object in Python

I'm working with quite a bit of data in Python. I'm currently using a lot of different arrays but I would like to use something similar to JSON format to make it easier.

something like:

metrics {
  .metric_name {
    .period {
      A: 10
      B: 20
    }
  }
}

so that I could call metrics.metric_name.A or whatever instead of using a lot of different multi-dim arrays.

Does anything like this exist in Python? Can I use dictionaries inside of dictionaries?

metrics = {
  "metric_name" : {
    "period" : {
      "A": 10,
      "B": 20,
    },
  },
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM