如果列表T是a.py中是全局的,则直接调用即可,例如

#a.py
T = [1,2,3,4]
def test():
    print("hello world!")
 
#b.py
import a
def test():
    for i in a.T:
        print i
运行b.py中test函数,将会输出a中T列表的值
 
如果要调用a.py中的函数:
则:print(a.test())
 

相关文章:

  • 2021-11-02
  • 2022-01-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-28
猜你喜欢
  • 2021-10-22
  • 2022-01-16
  • 2021-12-10
  • 2022-02-12
  • 2022-12-23
  • 2021-08-11
  • 2021-12-26
相关资源
相似解决方案