繁体   English   中英

我将如何 go 关于将外部 python 文件中的功能添加到当前 python 文件?

[英]How would I go about adding functions from external python file to current python file?

我主要是想用import命令把函数导入current_file.py。 我试着做:

from functions.py import *

但它会引发错误:

current_file.py and functions.py files are in the same directory.

删除“.py”扩展名

喜欢:

from functions import *

如果你想在你自己的函数路径中组织你的文件,你可以像这样导入:

from [your function path].[your function files] import *

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM