I agree with the above, but there are other options as well, which you might find either easier or more flexible:
You can use the option of defining your schedules in an external .csv file. This would allow you to make edits via Python to the csv rather than to the idf file. It also depends how complicated your heating and cooling setpoint schedules are. If they are a constant value all year, using regex commands (or f-strings, my other suggestion below) might be your best bet. But if the setpoints vary quite a bit throughout the year, I find the EnergyPlus text format to be cumbersome.
Another option that I use a lot is to use f-strings in Python. These allow you to insert Python variables into text files very easily. For example, you could define a heating setpoint variable in python called "htg_stpt" and set it to a value. Then, in your IDF, you can have something like this:
Schedule:Constant,
heating_sch, !- Name
Temperature, !- Schedule Type Limits Name
{htg_stpt}; !- Hourly Value
You need to be a little careful with this, though, because IDFs also use the "{ }" characters to define units. So, everywhere EnergyPlus uses "{ }" to define units, I just change them to "{{" and "}}". That way Python will not try to interpret the units as f-strings as well.
I have an open source project on GitHub called REEDR (https://github.com/PtarmiganConsultin...) that is essentially all Python code to build and run IDF files. If you look at the file "genmodels.py", you can see where I use the f-string trick, because it will look like this:
with open(TextFile, 'r') as f:
TextString = f"{f.read()}".format(**locals())
This code opens a text file, substitutes any f-strings you have defined, and saves it to a new text string. You can then save this new text string as a new IDF file, which you would pass to your subprocess command.