Does dictionary contain key containing multiple partial strings?
<p>I'm trying to test a dictionary to see if it contains keys that contain partial strings. Specifically, I am building a wing generator which assigns each feather's control to a dictionary. On a button click to mirror the wing, I need to test if the wing had already been mirrored (and then if it has subsequently been undone/deleted, but that's not part of this question and is easily tested for). I wish to do this by checking the feather dictionary to see if it has Keys containing both "L_" as well as "R_". </p>

<p>The following code does what I want, but is rather verbose. There has got to be a simpler, more elegant way to do it:</p>

<pre><code>dict={}
RS=False
LS=False
for each in dict:
    if "L_" in each:
        LS=True
    if "R_" in dict:
        LS=True
if LS and RS:
    print "has both"
</code></pre>

<p>alternatively, would it just be simpler to create another global variable and store a mirrored true/false value into that to test for? I'm trying to keep my global variables to a minimum, but am uncertain on how they influence resources. Any advice would be appreciated.</p>
