字典也有pop
pop(key[,default])
a = {1:2,3:4,5:6}
b = a.pop(3,None)
a
输出:
{1: 2, 5: 6}
没有key
a = {1:2,3:4,5:6}
b = a.pop(7,None)
a
输出:
{1: 2, 3: 4, 5: 6}
字典也有pop
pop(key[,default])
a = {1:2,3:4,5:6}
b = a.pop(3,None)
a
输出:
{1: 2, 5: 6}
没有key
a = {1:2,3:4,5:6}
b = a.pop(7,None)
a
输出:
{1: 2, 3: 4, 5: 6}