上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 41 下一页
  2012年4月16日
摘要: a.sh 1 #/bin/sh 2 echo "haha"; 3 exit 1;perl脚本22 my $output=qx(sh a.sh);23 my $exitcode=$?;24 $exitcode>>=8;25 print "output=$output\n";26 print "exitcode=$exitcode\n";27 system("pwd");28 print STDERR "$0 has finished,congratulations!\n";29 pri 阅读全文
posted @ 2012-04-16 17:42 finallyly 阅读(416) 评论(0) 推荐(0) 编辑
  2012年3月28日
摘要: my $size=scalar keys%hash_ref;37 print STDERR "top-level hash_ref $size\n";38 foreach my $key (keys %hash_ref)39 {40 $size=scalar keys%{$hash_ref{$key}};41 print STDERR "second-level hash_ref $size\n";42 43 }44 foreach my $key (keys %hash_ref)45 {46 foreach my $subkey (keys %{$ha 阅读全文
posted @ 2012-03-28 21:44 finallyly 阅读(1281) 评论(0) 推荐(0) 编辑
  2012年3月24日
摘要: http://developer.51cto.com/art/201007/211617.htm 本文和大家重点讨论一下Perl语言中Perl数字与字符串间的自动转换,这里从七个方面向大家介绍,相信通过过本文的学习你对Perl数字与字符串间的自动转换有一定的了解。Perl数字与字符串间的自动转换Perl会根据需要,在数字与字符串间进行自动转换:1、自动转换是根据操作符来的。如果操作符需要数字,它就会把字符串转换成数字;如果需要字符串,就会所数字转换成字符串。"12"."3"等同于"123""12"*"3& 阅读全文
posted @ 2012-03-24 10:44 finallyly 阅读(5517) 评论(0) 推荐(0) 编辑
摘要: use strict;use warnings;#数值比较大小和字符串比较大小my $str1="1 -the first str";my $str2="1 - the second str";if($str1==$str2){ print "numerically equal\n";}if($str1 eq $str2){ print "stringwise equal\n" ;}print "a.b"."haha" 有用的测试样例:usestrict;usewarning 阅读全文
posted @ 2012-03-24 10:31 finallyly 阅读(481) 评论(0) 推荐(0) 编辑
  2012年3月22日
摘要: 查看vi打开的文件的文件名的命令。ctrl+G :f 阅读全文
posted @ 2012-03-22 19:49 finallyly 阅读(311) 评论(0) 推荐(0) 编辑
  2012年3月15日
摘要: http://blog.csdn.net/oldjwu/article/details/4329401Python每次读入文件一行的问题分类:Python2009-07-07 21:461612人阅读评论(0)收藏举报 注意到Python每次读入一个文件的一行时,可以有两种写法:[python]view plaincopyf=open("bigFile.txt","r")whileTrue:line=f.readline()ifline:pass#dosomethinghereelse:breakf.close() 另一种写法为:[python]view 阅读全文
posted @ 2012-03-15 12:06 finallyly 阅读(33124) 评论(2) 推荐(0) 编辑
摘要: 原组不能更新,但是元组作为字典值时可以更新。demo如下 阅读全文
posted @ 2012-03-15 09:45 finallyly 阅读(348) 评论(0) 推荐(0) 编辑
  2012年3月14日
摘要: #!/usr/bin/python 2 # -*- coding: cp936 -*- 3 import sys; 4 import re; 5 ''' 6 原始文件,去重后文件,重复文件 7 ''' 8 if( __name__ == "__main__" ): 1 #!/usr/bin/python 2 # -*- coding: cp936 -*- 3 import sys; 4 import re; 5 ''' 6 原始文件,去重后文件,重复文件 7 ''' 8 if( 阅读全文
posted @ 2012-03-14 22:13 finallyly 阅读(3398) 评论(0) 推荐(0) 编辑
  2012年3月8日
摘要: 数据路径尽量是绝对路径,且数据路径同一在一个代码文件中管理;代码路径尽量是相对路径,便于移植;代码目录与数据目录要分开,省得删除的时候乱七八糟的,自己写的通用脚本要注意备份。 阅读全文
posted @ 2012-03-08 21:32 finallyly 阅读(312) 评论(6) 推荐(1) 编辑
  2012年3月4日
摘要: #!/usr/bin/pythonimport sys;import re;#-*- coding:cp936 -*-if(__name__=="__main__"): delim1='\t'; delim2=','; fid_input=file(str(sys.argv[1]),'r'); fid_output=file(str(sys.argv[2]),'w'); n=int(sys.argv[3]); p=re.compile('(^\s+|\s+$)'); amount_in=[]; 阅读全文
posted @ 2012-03-04 15:33 finallyly 阅读(2517) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 41 下一页