coms函数

使用主程序公共函数和用户信息

我们可以自定义一个 coms.py文件。

第一种调用方式 将公共函数加载到coms中:

from app.modules import xhook
#加载公共函数到当前程序
xhook.coms.init_apicom(globals())

使用上面函数,coms中就有了所有公共函数。
例如 port_stop(port)方法。
在coms中使用

port_stop(123)

在其他程序文件中使用:

form . import coms
coms.port_stop(123)

第二种方式:

from app.modules import xhook
apicom=xhook.coms.apicom

例如 port_stop(port)方法。
在coms中使用

apicom.port_stop(123)

在其他程序文件中使用:

form . import coms
coms.apicom.port_stop(123)
已采纳
再见旧时光
再见旧时光
QQ:986004469 Email:vutool@qq.com
2月前

6

0个回答默认排序 投票数排序
没有更多回答了~
本贴已经关闭回答功能~
0
1
0
1