Monday, 12 August 2013

How do I delete a key from a dictionary in Python?

How do I delete a key from a dictionary in Python?

I am doing this. I want to delete Galahad. It won't work
def run():
knights = {"Arthur":"king", "Lancelot":"brave", "Galahad":"pure",
"Bedivere":"wise"}
del Galahad:pure
run()

No comments:

Post a Comment