Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. email_fields = {'txt': ('subject', 'plaintext_body'),
  2. 'html': ('html_body',)}
  3.  
  4. >>> get_my_list(email_fields)
  5. [('txt', 'subject'), ('txt', 'plaintext_body'), ('html', 'html_body')]
  6.  
  7. foo = starmap(product, email_fields.items())
  8. chain.from_iterable(foo)
  9.  
  10. [('t', 'subject'),
  11. ('t', 'plaintext_body'),
  12. ('x', 'subject'),
  13. ('x', 'plaintext_body'),
  14. ('t', 'subject'),
  15. ('t', 'plaintext_body')],
  16. ('h', 'html_body'),
  17. ('t', 'html_body'),
  18. ('m', 'html_body'),
  19. ('l', 'html_body')]
  20.  
  21. foo = [product([ext], field) for ext, field in email_fields.items()]
  22. chain.from_iterable(foo)
  23.  
  24. [(k, v) for k in email_fields for v in email_fields[k]]
  25.  
  26. [('txt', 'subject'), ('txt', 'plaintext_body'), ('html', 'html_body')]
  27.  
  28. print [(k, item) for k in email_fields for item in email_fields[k]]
  29. # [('txt', 'subject'), ('txt', 'plaintext_body'), ('html', 'html_body')]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement