Use subprocess to run 'conda list" (in a conda environment), piping the result to a text file

I cannot figure out how to use my Anaconda Python to run a subprocess command like the following inside the Anaconda prompt environment:
conda list>z:\conda_pkgs\2024-04-19_14-25.txt
Any suggestions (e.g., referrals to a URL that might lead me to something instructive) would be much appreciated.
Thank you very much for any help.

You could do something like this:'conda list >z:\conda_pkgs\2024-04-19_14-25.txt', shell=True)