#!/usr/bin/python#-*-encoding:UTF-8-*-importsysiflen(sys.argv)<2:print(‘Usage:pythonsys.argv[0]FileName‘)sys.exit(1)else:print(‘\nunix2dos.pyexecutionsuccessfully!\n‘)File=sys.argv[1]fileobj=open(File,‘rU‘)try:allfile=fileobj.read()finally:fileobj.close()
分类:
编程语言 时间:
2014-08-26 19:53:57
阅读次数:
305
#-*-coding:utf-8-*-importosimportsysimporturllib2importpygameimportreimportsocketimportsubprocess#输入要测试的site值print"Hello"printpygame.versite=raw_input("PlsInputYourSite:")req=urllib2.Request(‘http://192.168.1.88/cc.txt‘)fd=urllib2.urlopen(req)#http:/..
分类:
编程语言 时间:
2014-08-26 19:52:57
阅读次数:
390
awk‘{printNR}‘aa.txt 变量NR,记录号awk‘END{print}‘aa.txt最后一行awk‘/22$/‘aa.txt 以22结尾的awk‘/^birdman/‘aa.txt 以birdman开头的的awk‘/\<^birdman.*22$\>/‘aa.txt 以birdman开头22结尾的行awk‘/\<^birdman.*22$\>/{print$2}‘aa.txt 以birdman开头22结尾的..
分类:
其他好文 时间:
2014-08-26 19:51:07
阅读次数:
195
Linux中find常见用法示例·findpath-option[-print][-exec-okcommand]{}\;find命令的参数;pathname:find命令所查找的目录路径。例如用.来表示当前目录,用/来表示系统根目录。-print:find命令将匹配的文件输出到标准输出。-exec:find命令对匹配的文件执行该参数所给出的shel..
分类:
系统相关 时间:
2014-08-26 19:49:07
阅读次数:
376
去除List列表中重复值(3种解决方法)public static void main(String[] args) { String[] ar = { "dd", "c", "dd", "ff", "b", "e", "e" }; ArrayList list = new ArrayLis...
分类:
其他好文 时间:
2014-08-26 19:22:56
阅读次数:
142
1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 [7] => 8 [8] => 9 [9] => 10 ) print_r($ary);/** * 2、创建长度为10的数组,数组中的元素为递增的等比数,比值为3。首项为1 */func....
分类:
Web程序 时间:
2014-08-26 19:20:16
阅读次数:
320
n全排列输出:int WPermutation(int num, bool bRepeat)num表示num全排列bRepeat标志是否产生重复元素的序列。int Permutation(int n, int* A, int cur, bool bRepeat) { static int numbe...
分类:
其他好文 时间:
2014-08-26 19:19:16
阅读次数:
228
int c = 0, space = 0, num = 0, other = 0;
char s[] = "djwiJFIW 123@#$!%";
// scanf("%s", s);
char *str = s;
while (*str != '\0') {
if ((*str >= 'A'...
分类:
其他好文 时间:
2014-08-26 17:23:06
阅读次数:
196
>>> reply = """Greetings...Hello %(name)s!Your age squared is %(age)s""">>> values = {'name': 'Bob', 'age':40}>>> print(reply % values)Greetings...Hel...
分类:
编程语言 时间:
2014-08-26 17:11:36
阅读次数:
335
最近要查看的日志文件提取后有很多空行,不利于以前的文件可以进行比较了,为了向下兼容,只能取得时候把空行删除掉。自己google了一下,用了grep方法,效率还是挺快的,25000+行中73行空行,瞬间搞定,应该可以接手。 方法一:(我就是用的这个)grep -v "^$" file 去除匹配的空行另...
分类:
其他好文 时间:
2014-08-26 17:02:26
阅读次数:
188