How can i pass password to command prompt automatically using python script

[root@codegaurd]# cat runplaybook.py
import subprocess
subprocess.run(['ansible-playbook', 'main.yml', '--ask-vault-pass'])


[root@codegaurd]# python3 runplaybook.py
Vault password:

I have to pass it in same code when prompted. I do not want to change the ansible command as passing the password file , script etc doesnt suit for my use case. i can hardcode in same script as i give the compiled file.