Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. #!/usr/bin/env python
  2. #
  3. # Copyright 2007 Doug Hellmann.
  4. #
  5. #
  6. # All Rights Reserved
  7. #
  8. # Permission to use, copy, modify, and distribute this software and
  9. # its documentation for any purpose and without fee is hereby
  10. # granted, provided that the above copyright notice appear in all
  11. # copies and that both that copyright notice and this permission
  12. # notice appear in supporting documentation, and that the name of Doug
  13. # Hellmann not be used in advertising or publicity pertaining to
  14. # distribution of the software without specific, written prior
  15. # permission.
  16. #
  17. # DOUG HELLMANN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  18. # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
  19. # NO EVENT SHALL DOUG HELLMANN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  20. # CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
  21. # OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  22. # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  23. # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  24. #
  25.  
  26. """Determine whether a module within a ZIP archive is a package or a regular module.
  27.  
  28. """
  29. #end_pymotw_header
  30.  
  31. import zipimport
  32.  
  33. importer = zipimport.zipimporter('zipimport_example.zip')
  34. for name in ['zipimport_is_package', 'example_package']:
  35. print name, importer.is_package(name)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement