url_import
url_import
- url_import.py
def url_import(name, url): import imp import tempfile from pathlib import Path from urllib import request path = Path(tempfile.mkstemp(suffix='.py', text=True)[1]) code = request.urlopen(url).read() path.write_bytes(code) mod = imp.load_source(name, str(path)) return mod mod = url_import("test", "https://rex8312.net/doku.php?do=export_code&id=mo-v-mpo:example&codeblock=0")
url_import.txt · 마지막으로 수정됨: 2024/03/23 02:38 저자 127.0.0.1