There's this popular book on penetration testing titled Violent Python. It's been written by T. J. O'Connor and was published in 2012.
Professor Sam Bowne held a workshop at BSidesSF this April and made something kindof along the same lines. So, the book is in part about developing specific tools to help with penetration testing in the Python programming language.
In this workshop, Prof. Bowne, goes through three levels of difficulty:
Overall, this workshop encompasses fairly good some of the things you'd be doing in terms of scripting and Python coding as a penetration tester. And since this is hands-on, I warmly recommend it to you if you're a cybersecurity professional.
Cristi Vlad Self-Experimenter and Author