I know this is simple, but I just can't figure it out. I have a bunch of keys in a dictionary, a large portion of which end with "*"
. I want to keep those keys but remove the asterisk.
for key, value in network.items():
if key.endswith('*'):
network[key.replace("*", "")] = network.pop(key)
The code runs, but the asterisks remain! Any insights as to why this is happening?