享學(xué)課堂車載學(xué)習(xí)
coding=utf-8data = {"name": "rose", "age": 19}# 遍歷字典并刪除某個(gè) key# 報(bào)錯(cuò):RuntimeError: dictionary changed size during iterationfor k, v in data.items():??if k == "name":????data.pop(k)
標(biāo)簽:
coding=utf-8data = {"name": "rose", "age": 19}# 遍歷字典并刪除某個(gè) key# 報(bào)錯(cuò):RuntimeError: dictionary changed size during iterationfor k, v in data.items():??if k == "name":????data.pop(k)