473,387 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Python Dict-List

3
If you have a dict with a list how do you get the info from the list.
Jun 8 '12 #1
4 2174
WooDoo
6
What do you mean get info list?
Jun 8 '12 #2
Dane R
3
Expand|Select|Wrap|Line Numbers
  1. dict = {'Alice': ["2","bookclub",],'Jane': ["3","mat club"]}
This is a sample of the dict, I need to print the person name and then the persons info next to their name
@WooDoo
Jun 8 '12 #3
WooDoo
6
Expand|Select|Wrap|Line Numbers
  1. dict = {'Alice': ["2","bookclub",],'Jane': ["3","mat club"]}
  2. for x,y in enumerate(dict):
  3.     # x is the dict key
  4.     # y is the list
  5.     for item in dict[y]:#dict[y] is lookup the item with the dict key        
  6.         print(y,item)
Jun 8 '12 #4
Dane R
3
Thanks for your help...............
Jun 8 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Don Bruder | last post by:
A week or two ago, I asked here about porting Python to C. Got some good answers (Note 1) but now I've got another question. Actually, more a request for clarification of a topic that both the...
1
by: venu gopal | last post by:
Hello people, iam finding great difficulty in handling a two-dimentional dictionary or any other similar data structure for the following purpose: from a collection of words,i need to have the...
9
by: Neil Benn | last post by:
Hello, I can't find the docs for __eq__ on a dict and I can't find a description on what the eq does (strangely it does implement > and < but I have no idea what that does). Does anyone know...
16
by: chosechu | last post by:
Hello Pythoneers: I need to pass a list of named arguments to a function in a given order, and make sure these named arguments are retrieved using keys() in the same order they were given....
10
by: could.net | last post by:
Python dict is a hash table, isn't it? I know that hashtable has the concept of "bucket size" and "min bucket count" stuff, and they should be configurable so I can set them to the proper value...
3
by: james_027 | last post by:
Hi, class UserDict: def __init__(self, dict=None): self.data = {} if dict is not None: self.update(dict) I just don't understant this code, as it is not also mention in the book. the update...
3
by: dmitrey | last post by:
hi all, what's the best way to write Python dictionary to a file? (and then read) There could be unicode field names and values encountered. Thank you in advance, D.
3
by: kj | last post by:
Hi. Does anyone know of a module that will take a suitable Python dictionary and return the corresponding XML structure? In Perl I use XML::Simple's handy XMLout function: use XML::Simple...
15
by: andyhume | last post by:
Hello... I have a dict of key/values and I want to change the keys in it, based on another mapping dictionary. An example follows: MAPPING_DICT = { 'a': 'A', 'b': 'B', }
0
by: danielo | last post by:
i have a python function like this : def func1(**fields) : ... fields is a python dict, in python i can send the following to the function : c = dict(a="3",b="4",f="3") func1(**c)
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.