问题:
When deleting a key from a dictionary, I use: 从字典中删除键时,我使用:
if 'key' in myDict:
del myDict['key']
Is there a one line way of doing this? 有没有一种方法可以做到这一点?
解决方案:
参考一: https://stackoom.com/question/lJm4/如何从Python字典中删除键参考二: https://oldbug.net/q/lJm4/How-to-remove-a-key-from-a-Python-dictionary
来源:oschina
链接:https://my.oschina.net/stackoom/blog/3217590