标签:
1、输入数据截取指定字段
1 mandatory_fields = ["-p","-s"] 2 for i in mandatory_fields: 3 if i not in self.args: 4 sys.exit("\033[31;1mLack of argument [%s]\033[0m" % i) 5 try: 6 self.ftp_host = self.args[self.args.index("-s") + 1] 7 self.ftp_port = int(self.args[self.args.index("-p") + 1]) 8 except (IndexError,ValueError): 9 self.help_msg() 10 sys.exit()
标签:
原文地址:http://www.cnblogs.com/zhang252709/p/5290162.html