I am trying to process a large text file. I would like to include parameters at some places in the file. Run it through python and write out the "processed" file with the values of the parameters in the new file.
Example: original file:
a =1
b=2
c= param1
d=4
Run python with param1=3: Gives new file with
a=1
b=2
c=3
d=4
---
Is this possible? The original text file will be around 100Mb and have maybe 100 parameters.
The general idea is to store the replacement values in a container like a dictionary, isolate the string that you want to test, and replace it if it is in the replacement dictionary. As stated above you could store them in a separate text file and read into a dictionary. The following code uses a list for input and output to simulate files, but gives the general idea.
Were you able to do this with the suggestions posted?
Hello
The suggested method works fine. I haven't been able to try it on a "production" size file yet. So I am not sure how long it will take. But on smaller files it works perfectly.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.