Skip to main content
 首页 » 编程设计

python之如何在 Python 中有条件地导入

2025年05月04日11davidwang456

<分区>

我想在 C 中做这样的事情:

#ifdef SOMETHING 
do_this(); 
#endif 

但在 Python 中,这并不适用:

if something: 
    import module 

我做错了什么?这首先可能吗?