I have two dictionaries with keys as string and values as integer:
ground = {"url1":1,"url2":2,....}
prediction = {"url1":5,"url2":3,....}
The thing I want to do is to delete key in ground if it does not exist in prediction.
I wrote the easiest thing that came to my head:
for key in ground:
if key not in prediction:
del ground[key]
and also tried this:
for key in ground:
if not key in prediction.keys():
del ground[key]
Neither worked. How can I achieve the goal?