小编Mon*_*man的帖子

从字典中提取重复值

我试图找到一种使用Python Dictionaries在Maya中删除重复着色器的方法.

这是我正在做的事情:

我想将所有maya着色器放入字典作为键,并将相应的纹理文件作为值.然后我希望脚本运行字典并找到共享相同值的任何键,并将它们填充到数组或另一个字典中.

这基本上就是我现在所拥有的:

shaders_dict = {'a': somePath, 'b': somePath,
                'c': differentPath, 'd': differentPath}

duplicate_shaders_dict = {}`
Run Code Online (Sandbox Code Playgroud)

我现在如何通过该字典来编译另一个类似于这样的字典:

duplicate_shaders_dict = {'b':somePath, 'd':differentPath }
Run Code Online (Sandbox Code Playgroud)

而棘手的部分是因为有重复我想要脚本skip the original key所以它也不会被填入复制着色器字典.

python dictionary

5
推荐指数
1
解决办法
2397
查看次数

标签 统计

dictionary ×1

python ×1