Python (r266:, Jan , ::) [GCC (Red Hat -)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> / >>> a = ) >>> b = ) >>> print a/b 0.838861354683
两段代码,第二段比较好些. 下面是Split输出结果方式的代码: #!/usr/local/bin/perl #Date:2015-07-07 print "Begin to restart tomcat\n"; my $output = `ps -ef|grep tomcat`; print "$output\n"; my $pid="-1"; my @arr=split(/\n/,$output); $length=@arr; ; while