daily pastebin goal
86%
SHARE
TWEET

Untitled

a guest Sep 19th, 2017 379 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python                                                                                      
  2.  
  3. current = {'name':'current', 'mail':'user@titi.fr', 'imap':'imap@toto.fr', 'pop':'pop@titi.fr'}
  4. MailList = [current]
  5. user = {'name':'username', 'mail':'user@titi.fr', 'imap':'imap@toto.fr', 'pop':'pop@titi.fr'}
  6. user2 = {'name':'pierre', 'mail':'pierre@titi.fr', 'imap':'imap@toto.fr', 'pop':'pop@titi.fr'}
  7. user3 = {'name':'roger', 'mail':'roger@titi.fr', 'imap':'imap@toto.fr', 'pop':'pop@titi.fr'}
  8.  
  9.  
  10. def addMailbox(MailList, user):
  11.     MailList.append(user)
  12.     print "addmailbox\n"
  13.     print MailList
  14.  
  15. def removeMailbox(MailList, user):
  16.     MailList.remove(user)
  17.     print "removemailbox\n"
  18.     print MailList
  19.  
  20. def selectMailbox(MailList, username):
  21.     print "selectmailbox\n"
  22.     for user in MailList:
  23.         if user["name"] == username:
  24.             return user
  25.  
  26. addMailbox(MailList, user)
  27. addMailbox(MailList, user2)
  28. addMailbox(MailList, user3)
  29. [MailList[0]] = selectMailbox(MailList, "pierre")
  30. print MailList.current
  31.  
  32.  
  33.  
  34. ERROR :
  35. Traceback (most recent call last):
  36.   File "./Mailbox.py", line 29, in <module>
  37.     [MailList[0]] = selectMailbox(MailList, "pierre")
  38. ValueError: too many values to unpack
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top