I have the following dictionary given and a list of keys. What I want to do this is that if these keys are in dictionary and has any numbers in the their value (which are strings). I want to change those numbers into '#' characters.
dict:
{"name":"Jone","age":"40 years","phone":"88777444"}
keys:
["age","phone"]
output:
{"name":"Jone","age":"## years","phone":"########"}
so far I have been able to grab those numbers but dont know how to change them in the dictionary:
my progress:
def convert(input, keys):
for k in range(len(keys)):
if keys[k] in input:
for el in input[keys[k]]:
if el.isdigit():
print(el)
As you can see I am using python. If you use different language a hint towards the right direction will be great.