# -*- coding: utf-8 -*-
class Obj:
string = u''
prop = u''
def printItem(lst):
print u'items:'
for item in lst:
print item.string
print item.prop
a = Obj()
a.string = u'A'
a.prop = u'null'
b = Obj()
b.string = u'B'
b.prop = u'null'
c = Obj()
c.string = u'C'
c.prop = u'null'
lst = [a, b, c]
printItem(lst)
for item in lst:
if item.string == u'B':
lst.remove(item)
continue
else:
item.prop = u'_add'
printItem(lst)
items:
A
null
B
null
C
null
items:
A
_add
C
null
0 件のコメント:
コメントを投稿