【发布时间】:2009-09-24 08:42:50
【问题描述】:
我是python的初学者。我想在 python 中创建新的 List 对象。
我的代码:
recordList=[]
mappedDictionay={}
sectionGroupName= None
for record in recordCols:
item = record
print item
if not sectionGroupName == record[0]:
sectionGroupName = record[0]
del recordList[0:] # Here I want to create new list object for recordList
recordList.append(item)
mappedDictionay[sectionGroupName] = recordList
else:
recordList.append(tempItem)
【问题讨论】:
-
你能说明你从什么数据结构开始,你想以什么结束吗?很可能有更好的方法来做你想做的事,但我无法从你的示例代码中解开它。