Closed. This question needs to be more focused。它当前不接受答案。
                            
                        
                    
                
                            
                                
                
                        
                            
                        
                    
                        
                            想改善这个问题吗?更新问题,使其仅通过editing this post专注于一个问题。
                        
                        5个月前关闭。
                                                                                            
                
        
文件json

{
  "102": "868",
  "103": "8648",
  "104": "868",
  "105": "8468",
  "1026": "8468",
  "107": "8648",
  "108": "85468",
}


我想做一个循环并获取键和值

最佳答案

looool [在python3.7中]

import json
with open(path_to_your_json_file) as f:
    d = json.load(f)
    for k in d:
        print(k, d[k])

关于python - 对于文件json中的键和值,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/58289190/

10-10 14:26