Jan-07-2022, 07:54 AM
Then the right way to do this is to grab each of the key/value pairs, examine the value and if it needs changing, update it by setting the key to have a new value.
for key, value in cybc.items(): # evaluate/change the value cybc[key] = updated_value(value) # updated_value() needs to return the correct value for your updateThe other concern I have is that the value might have a part of a number in it, but your current technique would throw away all the non-number parts. Is that what you want? Or it might have multiple numbers. Let's say one of your values is the string "1894-3999 RT". What do you want the new value to be? It can't be two integers. It could be one of the integers, or it could be a list or a tuple with both integers, or... ?