louis leichtnam wrote:
HEllo everyone,

I have a dictionnary, and I would like to print only the values that have
more/equal than 3 spaces in them for example: My name is Xavier.


d = {1: "Hello world", 2: "My name is Xavier", 3: "ham and eggs",
     4: "Eat more cheese please!", 5: "spam spam spam spam spam spam",
     6: "how much wood would a woodchuck chuck if a woodchuck would"
        "  chuck wood?", 7: "nice cup of tea and a slice of cake"}
for value in d.values():
    if value.count(" ") >= 3:
        print(value)



--
Steven

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to