Using Dictionary

Michiel Overtoom motoom at xs4all.nl
Tue Apr 14 09:53:26 EDT 2015


On Apr 14, 2015, at 15:34, Pippo wrote:

> How can I use dictionary to save the following information?

What a curious question. The purpose of a dictionary is not to save information, but to store data as a key -> value mapping:

    telbook = {}
    telbook["jan"] = "0627832873"
    telbook["mary"] = "050-932390"

Or do you mean 'store' when you mention 'save'?

...and to store a bunch of lines you don't need a dictionary either. A list would do:

info = [
    "#C[Health]",
    "#P[Information]",
    "#ST[genetic information]",
    ]

Greetings,

-- 
"You can't actually make computers run faster, you can only make them do less." - RiderOfGiraffes




More information about the Python-list mailing list