setdefault

a = {}
source = "Linkedin"
a[source ] = a.setdefault(source , 0) + 1

猜你喜欢

转载自www.cnblogs.com/NachoLau/p/11395403.html