【发布时间】:2021-07-10 05:52:13
【问题描述】:
Table_id = ['43c776cc-dcfe-498e-9e0c-465e498c4509','fbcbdda3-e391-42f0-b139-c266c0bd564d','caa5ebb5-
eee1-4261-8646-75139a22fa14']
naming= range(1,len(Table_id))
list_to_pop= Table_id.copy()
for i in range(len(Table_id)-1):
if i in Table_id:
print("Table_"+[naming[0]],i.pop())
naming.pop(0)
我想要的输出如下所示:
Table_1 = 'caa5ebb5-eee1-4261-8646-75139a22fa14'
Table_2 = 'fbcbdda3-e391-42f0-b139-c266c0bd564d'
Table_3 = '43c776cc-dcfe-498e-9e0c-465e498c4509'
有什么帮助吗?
【问题讨论】:
-
你想在 python 文件中定义这些变量吗?
-
我希望我的列表中的元素根据列表中的元素具有不同的名称,如果我选择第一个,它将被称为 Table_1 然后这个元素从列表,我们取第二个,它将被称为 Table_2 依此类推,最后我应该在列表中没有更多的元素,称为 table_id
标签: python for-loop if-statement while-loop popup