dwadewyp

dwadewyp

V2EX member #96796, joined on 2015-02-10 20:42:32 +08:00
Per dwadewyp's settings, the topics list is hidden
Deals info, including closed deals, is not hidden
dwadewyp's recent replies
Jan 16, 2021
Replied to a topic by dwadewyp Python 一个关于 Python 反射运用的问题
已解决:
在 animal __init__.py
```
import os
import pkgutil

pkgpath = os.path.dirname(__file__)
pkgname = os.path.basename(pkgpath)

for _, file, _ in pkgutil.iter_modules([pkgpath]):
__import__(pkgname+'.'+file)
```
Jan 16, 2021
Replied to a topic by dwadewyp Python 一个关于 Python 反射运用的问题
@tmackan inspect 刚才 我也简单看了下 貌似确实不满足
Jan 16, 2021
Replied to a topic by dwadewyp Python 一个关于 Python 反射运用的问题
@maocat
dir_path = os.path.abspath(os.curdir) + '/animal'

sys.path.append(dir_path)
亲测 也是无效
Jan 16, 2021
Replied to a topic by dwadewyp Python 一个关于 Python 反射运用的问题
@BBrother 亲测 元类在 package 外层 也是不行的,
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3150 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 13ms · UTC 14:34 · PVG 22:34 · LAX 07:34 · JFK 10:34
♥ Do have faith in what you're doing.