Nah
try:
index = keylist.index(keyIWantToFind)
keylist.pop(index)
urlist.pop(index)
nameslist.pop(index)
except ValueError:
pass
or
index = keylist.find( keyIWantToFind)
if index > -1:
keylist.pop(index)
urlist.pop(index)
nameslist.pop(index)
Remember a ListProperty is a list
See ya
T
T
Remember ListProperty is a list.
On Mar 16, 10:29 pm, sagey <[email protected]> wrote:
> Hello, i'd really appreciate some help.
>
> I have a model with 3 stringlistproperty properties.
>
> keylist
> urllist
> namelist
>
> keylist[0] relates to urllist[0] and namelist[0]
>
> i want to be able to search through the keylist property for a key,
> then delete each record in the 3 stringlistproperties that relate to
> it.
>
> I'm presuming the best way to do this is to iterate through the
> keylist incrementing a loopcount whilst doing so, and then deleting
> the elements of each stringlistproperty using the loopcount??
>
> hewres some pseudo code:
>
> keyIWantToFind = 'blah
> person = db.GqlQuery("SELECT * FROM Person WHERE You = :
> 1",users.get_current_user())
> if person:
> loopCount = 0
> for thekey in person.keyList:
> if keyIWantToFind == thekey:
> #do something to
> delete the elements from keylist,namelist and urllist
> # access the
> elements to be deleted by keylist[loopcount] ???
> loopCount = loopCount + 1
>
> I have 2 questions:
>
> 1) What syntax would i use to delete an element from a
> stringlistproperty, the gae documentation doesn't mention.
>
> 2) Is this the best way to do what i want to do?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---