擅长:python、mysql、java
<p>如果我需要使用字典作为键,我会将字典展成一个元组的元组。</p>
<p>你可能觉得这个问题很有用:<a href="https://stackoverflow.com/questions/635483/what-is-the-best-way-to-implement-nested-dictionaries-in-python">What is the best way to implement nested dictionaries?</a></p>
<p>下面是一个扁平化模块的示例,它将扁平化字典:<a href="http://yawpycrypto.sourceforge.net/html/public/Flatten.Flatten-module.html" rel="nofollow noreferrer">http://yawpycrypto.sourceforge.net/html/public/Flatten.Flatten-module.html</a></p>
<p>我不完全理解您的用例,我怀疑您试图过早地优化一些不需要优化的东西。</p>