在def_function.py文件里面写

#coding=utf-8

#定义函数
def hello():
    print "hello world"

  

在test.py里面调用

#coding=utf-8

from def_function import hello
#from def_function import * #导入该文件里的所有函数

#调用函数
hello()

  

在cmd下调用

python 定义函数 两个文件调用函数

 

相关文章:

  • 2021-10-19
  • 2022-12-23
  • 2021-10-19
  • 2022-12-23
  • 2021-07-03
  • 2021-11-15
  • 2021-10-19
猜你喜欢
  • 2022-12-23
  • 2021-10-19
  • 2022-12-23
  • 2021-10-19
  • 2022-12-23
  • 2021-05-19
  • 2022-12-23
相关资源
相似解决方案