Jun-07-2018, 08:20 AM
yes, that's relatively easy to do.
1. Create the mapping
2. For reading/writing csv files use csv module (and in particular csv.DictReader and csv.DictWriter, because of the mapping)
3. Transfer/populate the result file using the input file and derivative values (i.e. recipient_type)
So, now the devil is in the details and mostly will depend on the specifications for the result file. Do you have perfect mapping (i.e. extra/missing data)? Any difference in specifications (e.g. limited length for some fields, forbidden chars, etc.)? It depends what extra functionality you want - e.g. keep mapping as separate config file for easy manipulation, GUI/CLI interface, etc...
1. Create the mapping
2. For reading/writing csv files use csv module (and in particular csv.DictReader and csv.DictWriter, because of the mapping)
3. Transfer/populate the result file using the input file and derivative values (i.e. recipient_type)
So, now the devil is in the details and mostly will depend on the specifications for the result file. Do you have perfect mapping (i.e. extra/missing data)? Any difference in specifications (e.g. limited length for some fields, forbidden chars, etc.)? It depends what extra functionality you want - e.g. keep mapping as separate config file for easy manipulation, GUI/CLI interface, etc...
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs