semi-Newbie question

Cameron Laird claird at lairds.us
Thu Aug 10 18:52:25 EDT 2006


In article <1155245290.532108.75560 at 75g2000cwc.googlegroups.com>,
len <lsumnler at gmail.com> wrote:
>I appoligize I don't think I have done a very good job of explaining my
>problem.
			.
			.
			.
>The program I am writing is nothing more than a conversion program to
>take the value out of the CSV file and map it into the appropriate
>field in my SQL files.  Rather than creating some huge if than else
>(there are over 1000 tagnames) I created the xreffile.
>
>Now when I read a record from the tagfile I use the data in the tagname
>field to lookup the tagname in my xreffile.  The data in the
>SQL_fieldname is the fieldname in my SQL files I want to place the data
>from the tagfile in the tagfile.value field into this field in my SQL
>files;
>
>data referenced by(xreffile.SQL_fieldname) = tagfile.value
>
>what I see as the problem is I want to use what is the data reference
>by xreffile.SQL.fieldname and now make it part of the python code as a
>reference variable in an assignement code statement.
			.
			.
			.
1.  Take Daniel Wong's advice, elsewhere in this thread,
    and use the Python CSV module.
2.  "what I see as the problem is I want ...":  what you
    want *is* rather a problem, because it's a troublesome
    way to achieve what I understand to be your larger
    aims.  It was certainly good that you didn't create 
    "some huge if than else".

    Once you have an SQL_fieldname, and a tagfile.value,
    what do you want to do?  Are you stuffing data into
    an SQL table?  Continuing on with Python computations?
    In almost any case, it sounds as though you will profit
    greatly from study of Python's dictionaries <URL: 
    http://www.developer.com/lang/other/article.php/630721 >
    <URL: http://www.diveintopython.org/getting_to_know_python/dictionaries.html >.




More information about the Python-list mailing list