I would like to find an efficient and quick way to load the values of a list of global variables from a C header file into Python. For instance, suppose I have the file header.h:
/* comments */
int param_nx=2049; // comment
int param_ny=2049; // comment
double param_dt=0.01; // comment
Is there an easy way to read this file with Python, skip the comments, and define the corresponding variables there? I do not mind using the same variable name.
Try this.
Output: