It is common practice amongst ethical hackers to write nifty scripts and automate any structured process, ranging from small network scans to wide area network packet sniffing. In recent years, Python has become the language of choice for such tasks, and there are good reasons for this.
Python is brilliant for ethical hacking for the following reasons:
Nifty python libraries like Pulsar, NAPALM, NetworkX etc make developing network tools a breeze
Ethical hackers generally develop small scripts and python being a scripting language provides amazing performance for small programs
Python has a huge community, hence any doubt related programming is quickly solved by the community
Learning Python also opens up your doors to several other career opportunities