python如何在纸条中包含列表文件

2024-09-27 00:19:27 发布

您现在位置:Python中文网/ 问答频道 /正文

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

摘录:

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

Tags: 文件程序httpgeneratorcommonsavailabilitygroup1group2
1条回答
网友
1楼 · 发布于 2024-09-27 00:19:27

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

dependencies_custom.group2[0]

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

from dependencies_custom import *

相关问题 更多 >

    热门问题