Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > simple question about Dictionary type containing List objects

Reply
Thread Tools

simple question about Dictionary type containing List objects

 
 
gganesh
Guest
Posts: n/a
 
      07-13-2009
Hi group,
I have a dict object like
emails={'mycontacts': [ '(E-Mail Removed), '(E-Mail Removed)',
'(E-Mail Removed)'], 'myname':['gganesh']}
I need to get the lenght of the list mycontacts ,like
mycontacts_numbers=3
help me to solve
Thanks


 
Reply With Quote
 
 
 
 
Ulrich Eckhardt
Guest
Posts: n/a
 
      07-13-2009
gganesh wrote:
> I have a dict object like
> emails={'mycontacts': [ '(E-Mail Removed), '(E-Mail Removed)',
> '(E-Mail Removed)'], 'myname':['gganesh']}
> I need to get the lenght of the list mycontacts ,like
> mycontacts_numbers=3


mycontacts = emails['mycontacts']
mycontacts_number = len(mycontacts)

A list doesn't change in behaviour when it is contained in a dictionary.

Uli

--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting an array list containing objects? Rob Meade ASP .Net 4 11-04-2012 04:29 AM
Object containing a list of objects. cocolombo Python 5 08-28-2010 06:23 PM
convert string containing list to list (or tuple) type Poppy Python 1 05-30-2008 02:17 PM
Objects containing objects Steve Perl Misc 2 01-13-2008 12:39 PM
dictionary containing a list Ben Python 10 10-09-2006 04:35 AM



Advertisments