Can I define all except one argument for one the option in python?
I want to shutdown all hosts in lab except one host.
For argparser I have given -h ^server1
which should be pick all hosts from host list except server1.
Something simple. Remove any hosts from the list that start with ^. Call some sort of shutdown function for each host name in the revised list.
hostlist = [x for x in hostlist if not x.startswith('^')]
map(shutdownhost, hostlist)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With