Split dictionary depending on key lists
<p>I have a data dictionary with eeg, gyroscope and other data. For processing, I want to extract eeg and gyroscope data in seperate dicts. Therefore I have two lists with the keys of eeg and gyroscope. I made it work with two dict comprehensions, but maybe there is a smoother solution to this.</p>

<pre><code>eegKeys = ["FP3", "FP4"]
gyroKeys = ["X", "Y"]

# 'Foo' is ignored
data = {"FP3": 1, "FP4": 2, "X": 3, "Y": 4, "Foo": 5}

eegData = {x: data[x] for x in data if x in eegKeys}
gyroData = {x: data[x] for x in data if x in gyroKeys}

print(eegData, gyroData) # ({'FP4': 2, 'FP3': 1}, {'Y': 4, 'X': 3}) 
</code></pre>