May-04-2019, 10:10 AM
hello dear Python-experts
i am currently creating an 'adress book' python where i want to use dictionaries?
the plan:
I'm trying to create an little adress-book that has got an index
the index - think would be apropiate - could be the 'nickname' in the adress-book
I want to give some options:
with the nickname the user can do some savings:
a. save a name of a person, the address of a person and subsequently the phone-number of that person.
well - so far so good: - i want to use use a dictionaries, i want to have such a list. e.g
well - i could do some starting points - with the usage of a dictionary:
i could probably start with this:
But how to get access to the records that i have created: well i can access records using
or like so
: Keys in a Python dictionary tend to be unique. Having a list of contacts in my adressbook the important thing is - there should be no name twice. That saind - we see that i can have the solution like this:
so adding data to a dictionary is based on the access operator [].
the question is: how to extend the scipt a bit
should i make use of
- raw input
- arg.pop
how would you extend the script!?
what do you say!?
love to hear from you
apollo
i am currently creating an 'adress book' python where i want to use dictionaries?
the plan:
I'm trying to create an little adress-book that has got an index
the index - think would be apropiate - could be the 'nickname' in the adress-book
I want to give some options:
with the nickname the user can do some savings:
a. save a name of a person, the address of a person and subsequently the phone-number of that person.
well - so far so good: - i want to use use a dictionaries, i want to have such a list. e.g
1 2 3 |
myList = [[ "Bill" , "Butcher" , "4433345411" ],[ "Billiboy" , "2 Rue Rivoli " , "0994399394800838383" ]] And then if I wanted to see a certain contact I would just use some more code to search for a pattern. And then i need to figure out how to do it with a dictionary? |
i could probably start with this:
1 2 3 4 5 6 |
my_dict = { "Don" : { "name" : "Donald Jones" , "address" : "1 Rue Rivoli Paris " , "phone" : "9444444411" }, "Joseph" : { "name" : "Joseph Boy" , "address" : "3 Tivoli Paris" , "phone" : "0800838383" } "Bilbo" : { "name" : "Bilbo Baggin" , "address" : "4 White House Washington" , "phone" : "08055550838383" } } |
1 |
my_dict[ "Don" ][ "name" ] |
1 |
my_dict[ "Bilbo" ][ "phone" ] |
1 |
BTW |
1 2 3 |
contacts = {} contacts[ 'Don' ] = [ "1 Rue Rivoli" , 9444444411 ] contacts[ 'Joseph' ] = [ "3 Tivoli" , 0800838383 ] |
the question is: how to extend the scipt a bit
should i make use of
- raw input
- arg.pop
how would you extend the script!?
what do you say!?
love to hear from you
apollo

Wordpress - super toolkits a. http://wpgear.org/ :: und b. https://github.com/miziomon/awesome-wordpress :: Awesome WordPress: A curated list of amazingly awesome WordPress resources and awesome python things https://github.com/vinta/awesome-python