semi-Newbie question

len lsumnler at gmail.com
Thu Aug 10 13:11:37 EDT 2006


Hi all

I have a file that I receive from another party which is basicly a csv
file containing the following type of information;

Tagname             Scope          Value
"first_name","POL01","John"
"last_name","POL01","Doe"
"birthday","POL01","04/03/61"
etc

I need to convert this file info into my file format used in my
application.

I have been given a file from the other company that gives me all of
the tagname that could be used and their scope.  I want to build a
table which would have all of the various tagnames, scope, and put a
fieldname equivalent in the fieldname in my file structure in my
application.  Then read through the vendors csv file index into my
table file and get the field name of where to move the data into my
data structure.

Here is my question?  basicly I need to get the data referenced by
fieldname variable in my table and then use that data as a variable
name in a python assignment statement. Thus changing the actual python
code at each iteration through the lines in the csv file.

for i in tagfile
  find tagname in tagtable

*** the following line of code would change through each iteration ***
  myfirst = value

*** next iteration
  mylast = value

*** next iteration
  mybirth = value

etc

I hope this make sense.  I remember seeing something like this
somewhere.

Any help appreciated.

Len Sumnler
Unique Insurance




More information about the Python-list mailing list