Can you give us an idea what the final product is supposed to look like?
vegaseat
DaniWeb's Hypocrite
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
You could use a list of tuples.
# working with a list of tuples
tuple1 = ('yo', '0001100 0011100')
tuple2 = ('do', '0001101 0011100')
tuple3 = ('mm', '0001111 0011100')
list_of_tuples = [tuple1, tuple2, tuple3]
print list_of_tuples
# optional sort
list_of_tuples.sort()
print list_of_tuples
# search for a word (or a vector)
for tup in list_of_tuples:
if 'mm' in tup:
word, vector = tup
print word, vector
vegaseat
DaniWeb's Hypocrite
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417