How can I communicate between a Siemens S7-1200 and python?
I would use libnodave on PC side to change value of some M tag or a DB tag in a PLC. You can easily make a ladder rung which will monitor this tag and execute further actions. Although libnodave doesn't support Python natively, you can find a python wrapper here.
After failing with libnodave and OPC, I created a TCON,TSEND and TRECV communication thing. It transmits a byte over TCP and it works.
I would go with SNAP7 and python-snap7 libraries. Example on how to install it on a Raspberry pi found in this blog: http://simplyautomationized.blogspot.com/2014/12/raspberry-pi-getting-data-from-s7-1200.html
Update:
Video walkthrough on how to set it up: https://youtu.be/yJNEsI5KJxs