CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Thu, 24 Jul 2025 22:31:18 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20071208095754
location: https://web.archive.org/web/20071208095754/https://wiki.python.org/moin/LoadingModulesDynamically
server-timing: captures_list;dur=0.540571, exclusion.robots;dur=0.024689, exclusion.robots.policy;dur=0.012163, esindex;dur=0.013344, cdx.remote;dur=13.121933, LoadShardBlock;dur=757.367305, PetaboxLoader3.datanode;dur=397.481017, PetaboxLoader3.resolve;dur=272.579605
x-app-server: wwwb-app214
x-ts: 302
x-tr: 804
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: SERVER=wwwb-app214; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Thu, 24 Jul 2025 22:31:19 GMT
content-type: text/html;charset=utf-8
x-archive-orig-date: Sat, 08 Dec 2007 09:57:53 GMT
x-archive-orig-server: Apache/2.0.54 (Debian GNU/Linux) mod_fastcgi/2.4.2
x-archive-orig-connection: close
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Sat, 08 Dec 2007 09:57:54 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Tue, 10 Oct 2006 07:57:40 GMT", ; rel="prev memento"; datetime="Tue, 10 Oct 2006 07:57:40 GMT", ; rel="memento"; datetime="Sat, 08 Dec 2007 09:57:54 GMT", ; rel="next memento"; datetime="Thu, 11 Aug 2011 04:04:46 GMT", ; rel="last memento"; datetime="Sun, 21 Jul 2024 03:54:19 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 52_1_20071208084132_crawl105-c/52_1_20071208095245_crawl107.arc.gz
server-timing: captures_list;dur=0.756996, exclusion.robots;dur=0.028607, exclusion.robots.policy;dur=0.013027, esindex;dur=0.015469, cdx.remote;dur=27.441144, LoadShardBlock;dur=246.861959, PetaboxLoader3.datanode;dur=153.567454, PetaboxLoader3.resolve;dur=226.162098, load_resource;dur=238.347018
x-app-server: wwwb-app214
x-ts: 200
x-tr: 580
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=1
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
LoadingModulesDynamically - PythonInfo Wiki
LoadingModulesDynamically
You can load a module dynamically like so:
1 __import__("os")
If you do that, though, "os" isn't bound to anything.
1 >>> __import__("os")
2 <module 'os' from '/usr/lib/python2.3/os.pyc'>
3 >>> os
4 Traceback (most recent call last):
5 File "<stdin>", line 1, in ?
6 NameError: name 'os' is not defined
7 >>>
Once you have the module, you probably want to find classes and functions and data inside of it.
Use getattr:
1 >>> m=__import__("mine")
2 >>> m
3 <module 'mine' from 'mine.pyc'>
4 >>> getattr(m, "eggs")
5 4654
6 >>> getattr(m, "ham")
7 'Monty Python'
EditText (last edited 2005-02-21 05:44:20 by LionKimbro)
DeleteCache (cached 2007-11-21 18:09:35)- Login
- Navigation
- Actions
- Your recent pages