How to specify a field name dynamically

jack naruto0.1 at live.cn
Wed Nov 7 04:14:00 CET 2012


I have three tables:
     table1
         |———————|
         |  id  |  f1   |
         |———————|

     table2
         |———————|
         |  id  |  f2   |
         |———————|

     table3
         |———————|
         |  id  |  f3   |
         |———————|


I want define a function to insert records to someone,but I don't know 
how to specify a field name dynamically.
I had a try like this

/    def insert_record(table, field, goods)://
//        return db.insert(table, field=goods//)/
or
/    def insert_record(table, **kv)://
//        return db.insert(table, **kv)/

but it does not works
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20121107/bafd2dd5/attachment.html>


More information about the Python-list mailing list