When I program I often use external software to do the heavy computations, but then analysis the results in Python. These external software is often Fortran, C or C++, which works by giving them input file(s). This can either be a small file telling which mode to perform certain calculations, or a large data file it has to process. These files often use a certain format (so and so many spaces between data columns). An e.g. is given below for a data file I currently use.
This is a header. The first line is always a header...
7352.103 26.0 2.61 -8.397 11.2
7353.510 26.0 4.73 -1.570 3.5
7356.643 26.0 5.75 -2.964 9.0
7356.648 26.0 5.35 -3.187 9.0
7364.034 26.0 5.67 -5.508 1.7
7382.523 26.0 5.61 -3.935 1.9
My question is if there exist a Python library to create such input files, from reading a template (given by a coworker or from documentation of the external software)?
Usually I have all the columns in a NumPy
format and want to give it to a function that creates an input file, using the template as an example. I'm not looking for a brute force method, which can get ugly very quickly.
I am not sure what to search for here, and any help is appreciated.