I'm trying to go through a list of dictionary's and replace one of the
key's fields (an idnumber) with another field from a table. The code
currently looks like:
--------------
regex = re.compile(r'\[(\d+)\,') #Match's my item numbers
for Dictionary in DictList:
list = Dictionary['Reagents']
idnumList = regex.findall(list)
----------------
This gives me a nice list (idnumList) with id numbers in it. However
I can't seem to find a way to take each of these idnumbers, look them
up in a table and return a different field (name).
I've been trying:
----------------
for idnum in idnumList:
item=sqldb(sqldb.item.idnum==idnum.isdigit()).select()
Dictionary['Reagents']=list.replace(idnum,item.name)
---------------
But I'm told item.name isn't a valid field. Am I going about this the
right way, can someone point me in the right direction?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---