Pure Python and Matlab readers for Fortran namelist => dict / struct
These are as basic as possible, for putting in your own program directly. They output dict (Python) or struct (Matlab).
Consider f90nml for a full-featured read/write Fortran namelist Python package.
from read_namelist import read_namelist
print(read_namelist('example.nml', 'base'))
read_namelist('example.nml', 'base')
read.f90 example shows that one must allocate arrays before reading a namelist array variable. Character can be read with a variable (much) longer than known needed, then trim() to another allocatable character variable. Despite what some forums say, reading namelist directly into allocatable just segfaults with Intel or GCC compilers.