Kent Johnson wrote:
Scott Oertel wrote:
  
The next problem I have though is creating the dict,

i have a loop, but i can't figure out how to compile the dict,  it is 
returning this: ('Joey Gale', ('Scott Joe', 'This is lame' )))


listofnames = []
while (cnt < number[1][0]):
    if (date[2] == today[2]):
        test = regex.findall(M.fetch(int(number[1][0]) - cnt, 
'(BODY[HEADER.FIELDS (FROM)])')[1][0][1].rstrip())
        cnt += 1
        if (nameofsender != []):
            print nameofsender[0]
            listofnames = nameofsender[0], listofnames
    

I think you want 
  listofnames.append(nameofsender[0])
which will add nameofsender[0] to the list. What you have -
  listofnames = nameofsender[0], listofnames
is making a tuple (a pair) out of the new name and the old list, and assigning it to listofnames. Kind of like CONS in LISP - but Python lists are more like arrays than like LISP lists.

Kent

  
        else:
            no_name += 1
    else: break



------------------------------------------------------------------------

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
    

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
  
Thank you everyone, this is exactly it, I'm going to take that link from byron and read up on dicts/lists.

-Scott Oertel
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to