If he would like to do this from the python side of the lammps-python interface, there are multiple ways to handle it. One is doing something similar to what is in LAMMPS' mc.py example, where extract_compute is getting the value of a thermo property every timestep, and then the simulation is advanced using a for loop and individual "run 1 pre no post no" commands. That approach may be used for a MD run, and use any desired extract_* (such as extract_variable). Another option is to use the "fix vector" command, accumulating various thermo quantities every N timesteps during a run, and then extracting them at the end of the run using extract_fix. I've had success with both approaches for different purposes.
Axel's suggestion of doing it from the LAMMPS side using python-style variables may be fruitful, too. The python functionality in LAMMPS is quite powerful, and a great feature.
In answer to John Rivas’ query and my own earlier, I have hacked together a small routine in python to pull out the thermo output from the log file, write it to a separate file, and read it into arrays/vectors
N.B. I’m new to LAMMPS and lack a strong background in python, so the attached is surely not optimal, but it appears to work and may be of benefit to anyone else facing this issue
Thank you Brian and Axel - I will read more about defining an appropriate fix and extracting that as I expect it will be much more efficient that what I currently have