效字当先,以质为本。测试开发入行十余年,辉煌过,迷茫过,持续探寻人生的激情和前进的步伐!好好生活,认真工作!
发布时间:2013-08-21 17:55:07
import urllibimport jsonip ='192.168.100.230'url="http://"+ip+":5001/channels/adam_channels/"response = urllib.urlopen(url).read()json_obj = json.loads(response)for a in json_obj: print a['is_adam_stat']......【阅读全文】
发布时间:2013-08-21 17:01:50
1、f=file("c:/pick","r")print f.read()f.close2、with open("dddd.txt","r") as f: print f.read()with open("dddd.txt","w") as f: f.write("lovelovelove")两者都是打开一个文件,但1和2的不同之处在于,1需要处理完后关闭文件:f.close(),2不需要此语句即可关闭文件;建.........【阅读全文】
发布时间:2013-08-21 15:41:02
先举一个例子:def eggs_and_bread(eggs_num,bread_pieces): print "I have %d eggs" %eggs_num print "I have %d pieces of bread" %bread_piecesprint eggs_and_bread(10,20) .........【阅读全文】
发布时间:2013-08-21 14:58:40
#key value结构;stuff={"age":27,"sex":"famale",'height':50} ###定义一个字典,有Key有value;print stuff['age'] stuff['city']='beijing' .........【阅读全文】
发布时间:2013-08-21 13:36:45
1、print set([1,2,3,4,5,5,6])结果:>>> set([1, 2, 3, 4, 5, 6]) ####散列结构,无重复值;set函数有去重的功效;2、set1 =set([1,2,3,4,4])set2 =set([2,3,4,5,6])print set1-set2 ##set1有set2没有print set1&set2 &.........【阅读全文】