29.2.2 使用例

モジュールを ZIP アーカイブから import する例を以下に示します - zipimport モジュールが明示的に使われていないことに注意 してください。

$ unzip -l /tmp/example.zip
Archive:  /tmp/example.zip
  Length     Date   Time    Name
 --------    ----   ----    ----
     8467  11-26-02 22:30   jwzthreading.py
 --------                   -------
     8467                   1 file
$ ./python
Python 2.3 (#1, Aug 1 2003, 19:54:32) 
>>> import sys
>>> sys.path.insert(0, '/tmp/example.zip')  # パス先頭に .zip ファイル追加
>>> import jwzthreading
>>> jwzthreading.__file__
'/tmp/example.zip/jwzthreading.py'
ご意見やご指摘をお寄せになりたい方は、 このドキュメントについて... をご覧ください。