Aug-29-2018, 07:05 PM
please, show what your CONFIG.inp file looks like and what the expected output is (one file)
did you check configparser module and can you use it? i.e. is your file compatible with a format that configparser can read?
did you check configparser module and can you use it? i.e. is your file compatible with a format that configparser can read?
names = ['b','c','d','e'] with open('CONFIG.inp') as f: current_config = f.read() for i, name in enumerate(names, start=1): new_config = current_config.replace('a', name) with open(f'COFIG{i}.inp', 'w') as f: f.write(new_config)untested, but should work for python 3.6+
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