python scrpting for changing the channel

Hi,
I am new to python scripting language , I want to write the code for stability , to change the video from HDMI to DVD, I want to run this whole night, I need scripting for this, can any one help me out with this.

Thanks& Regards,
Deepthi