gpt4 book ai didi

python - 按需功能共享

转载 作者:太空宇宙 更新时间:2023-11-04 11:00:08 24 4
gpt4 key购买 nike

<分区>

我需要将字符串转换为名为引用的代码。目前唯一已知的选项是制作脚本的脚本,我认为它可以像 exec 一样内联。

class finder:
def __init__(self, parent):
self.parent = parent
def isin(self, what):
return what in self.parent
def find(self, what):
if self.isin(what): return self.parent.__dict__[what.__name__]
else: return __import__("pull").__dict__["downloader"](self.parent.hosts).download(what)
def put(self, what):
f = self.find(what)
self.parent.__dict__[f.__name__] = f

from sock import Socket
from unpack import unpacker

...

class downloader:
def __init__(self, hosts):
self.hosts = hosts
def download(name):
for host in hosts:
pack = unpacker()
s = Socket(host[0], host[1])
s.send("get " + name)
f = pack.unpack(s)
if f is not None: return f

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com