Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我可以为python中的一个选项定义一个参数以外的所有参数吗?
我想关闭实验室中除一台主机之外的所有主机。因为argparser我已经给出-h ^server1 了应该从主机列表中选择所有主机,除了server1.
argparser
-h ^server1
server1
一些简单的东西。从列表中删除所有以 开头的主机^。为修改后的列表中的每个主机名调用某种关闭函数。
^
hostlist = [x for x in hostlist if not x.startswith('^')] map(shutdownhost, hostlist)