如何在Python中过滤掉字典中的非字符串键?

Mne*_*yne 1 python dictionary

我是 Python 新手,试图弄清楚如何过滤掉字典中的所有非字符串键。我感谢您能提供的任何帮助。

aad*_*hsg 5

 { key: dict[key] for key in dict.keys() if isinstance(key, int) }
Run Code Online (Sandbox Code Playgroud)