Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

searching within python lists

Name: Anonymous 2013-03-19 21:29

if i have
cat = ['smelly', 'furry', 'claws']
dog = ['smelly', 'loud', 'stupid']
animals.append(cat)
animals.append(dog)

how can i easily search the list 'animals' for which list items are labeled 'smelly'. after that i want to somehow mark that 'dog' and 'cat' were found to be similar due to them both having the attribute 'smelly'

simple way to do this /prog/?

Name: Anonymous 2013-03-19 23:45

>>4
im writing a logical sorting and grouping reference module for an AI. i eventually will have many many animals (among other things) in here with attributes that can be cross referenced to find things when a query is as simple as a "whats that brown stuff that plants grow in?" in this case mulch, dirt, feces are all brown stuff that plants grow in. i would want them marked as similar because of their 'brown' and 'plants grow in' attributes.

>>3
i'd rather not. ive heard terrible things.


so no ideas /prog/?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List