Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/306.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
python如何在脚本中包含列表文件_Python - Fatal编程技术网

python如何在脚本中包含列表文件

python如何在脚本中包含列表文件,python,Python,我有一个文件,该文件由以下程序生成: 摘录: group0 = ['ParentPom'] group1 = ['Commons','http', 'availability','ingestPom','abcCommons','solrIndex','123Service'] ... group10=['totalCommons','Generator'] 我怎么能在我的python脚本中包含这个,尝试导入但没有运气 >>> import dependencies_c

我有一个文件,该文件由以下程序生成:

摘录:

group0 = ['ParentPom']

group1 = ['Commons','http', 'availability','ingestPom','abcCommons','solrIndex','123Service']

...

group10=['totalCommons','Generator']
我怎么能在我的python脚本中包含这个,尝试导入但没有运气

>>> import dependencies_custom
>>> print (group2[0])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'group2' is not defined
>>导入依赖项\u自定义
>>>打印(组2[0])
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
NameError:未定义名称“group2”

在您使用的
导入
表单中,您应该能够通过

dependencies_custom.group2[0]
类型符号。如果只想使用just
group2[0]
表示法,请尝试使用:

from dependencies_custom import *

在您使用的
import
表单中,您应该能够通过

dependencies_custom.group2[0]
类型符号。如果只想使用just
group2[0]
表示法,请尝试使用:

from dependencies_custom import *