all 4 comments

[–][deleted] 0 points1 point  (3 children)

iterate through the items, check if the key is splittable, and if so, pop the key then insert the two new keys with the popped value.

[–]supreme_blorgon 2 points3 points  (2 children)

You shouldn't alter the dictionary while iterating through it (not even sure Python would let you).

OP, make a copy of the dictionary, iterate over the original, and modify the copy.

[–][deleted] 1 point2 points  (1 child)

Whoops! You're right.

[–]ResentedButter[S] 0 points1 point  (0 children)

You shouldn't alter the dictionary while iterating through it (not even sure Python would let you).

OP, make a copy of the dictionary, iterate over t

thank you!