dict

dict

import os

doclist = dict()
list = os.listdir("./data")
for ls in list:
    files = ls.split('_')
    if 3 == len(files):
        #print(files[0])
        # 在字典里插入字典
        doclist.setdefault("name", dict()).setdefault(files[0], files[1])
        doclist.setdefault("version", dict()).setdefault(files[0], files[2])


for dict1 in doclist["name"].keys():
    flesname = dict1 + doclist["name"][dict1] + doclist["version"][dict1]
    print(flesname)
    name = doclist["name"][dict1]
    print(name)