#!/usr/bin/envpython#-*-coding:utf-8-*-importsysfromthreadingimportThreadimportsubprocessfromQueueimportQueuenum_threads=3ips=[‘127.0.0.1‘,‘192.168.20.140‘]q=Queue()defpingme(i,queue):whileTrue:ip=queue.get()print‘Thread%spinging%s‘%(i,ip)ret=subprocess.cal..
分类:
编程语言 时间:
2015-09-22 14:45:14
阅读次数:
341
代码如下#!/usr/bin/python
importos
importjson
data={}
diskname_list=[]
disk_list=[]
command=‘‘‘iostat|awk‘{print$1}‘|grep^[vd]‘‘‘
lines=os.popen(command).readlines()
forlineinlines:
disk_name=line.strip(‘\n‘)
disk_list.append(disk_name)
fordisk_namein..
分类:
其他好文 时间:
2015-09-22 14:43:46
阅读次数:
213
1.String getParamer(String name),获取控件里面name的值,返回控件里面name值。String username = req.getParamter("username");2.response.setContentType("text/html");3.Print...
分类:
Web程序 时间:
2015-09-22 14:26:07
阅读次数:
141
9.6 Implement an algorithm to print all valid (e.g., properly opened and closed) combinations of n-pairs of parentheses.EXAMPLEInput: 3Output: ((())),...
分类:
其他好文 时间:
2015-09-22 14:20:34
阅读次数:
133
Python中的装饰器假定现有如下需求:已经定义了一个函数,想在运行时动态增加其功能,又不想改动函数本身的代码。应该如何实现呢?比如现在定义了f1函数如下: def f1(x): return x*2 print f1(5)那么...
分类:
编程语言 时间:
2015-09-22 06:36:24
阅读次数:
136
]*>/i', $text, $match); //打印出match print_r($match);
分类:
Web程序 时间:
2015-09-21 23:49:56
阅读次数:
181
1.在print方面,新版本需要加括号,调用函数时也是如此,比如:1 import string2 s='the quick brown fox jumped to the lazy dog'3 print (s)#原版本为 print s4 print (string.capwords(s))#原...
分类:
编程语言 时间:
2015-09-21 22:35:31
阅读次数:
147
#?-*-?coding:?cp936?-*-?
#下面这个函数接受voltage为必选参数,其余三个为可选参数
def?parrot(voltage,state=‘a?stiff‘,action=‘voom‘,type=‘Norwegian?Blue‘):
print("--This?parrot?wouldn‘t",a...
分类:
编程语言 时间:
2015-09-21 16:06:43
阅读次数:
218
1 print("...............我爱鱼C工作室..................") 2 temp=input("不妨猜一下小甲鱼现在心里想的是那个数字:") 3 guess=int(temp) 4 if guess==8: #添加“:”号后 点击回车会自动缩进 缩进相当...
分类:
其他好文 时间:
2015-09-21 15:35:33
阅读次数:
101
2to3 Although it’s perfectly possible to just run your Python?2 code under Python?3 and fix each problem as it turns up, this quickly becomes very tedious. You need to change every print statem...
分类:
编程语言 时间:
2015-09-21 12:39:01
阅读次数:
244