摘要:
#!/usr/bin/python#-*- coding:cp936 -*-import re;import os;import sys;if(__name__=="__main__"): p=re.compile('(^\s+|\s+$)'); pdigit=re.compile('^\d+'); delimiter='\t'; strdict='dict.dat'; strcontigency='contigency.dat'; str_input=str(sys.argv[1]); str 阅读全文
摘要:
HDFS File System Shell GuideOverviewcatchgrpchmodchowncopyFromLocalcopyToLocalcountcpdudusexpungegetgetmergelslsrmkdirmoveFromLocalmoveToLocalmvputrmrmrsetrepstattailtesttexttouchzOverviewThe FileSystem (FS) shell is invoked bybin/hadoop fs <args>. All FS shell commands take path URIs as argum 阅读全文
摘要:
#!/usr/bin/pythonimportsys;importre;defgetPrecision(TP,TN,FP,FN):result=0.0;result=TP/(TP+FP);returnresult;defgetRecall(TP,TN,FP,FN):result=0.0;result=TP/(TP+FN);returnresult;defgetFvalue(TP,TN,FP,FN):result=0.0;p=getPrecision(TP,TN,FP,FN);r=getRecall(TP,TN,FP,FN);result=2*p*r/(p+r);returnresult;def 阅读全文
摘要:
1.数据管理脚本:原始文件格式id\tclusterId\tgoldstandardIdDataManagement.py#!/usr/bin/pythonimportcPickleasp;importsys;importre;if(__name__=="__main__"):filename=str(sys.argv[1]);preturn=re.compile('(^\s+|\s+$)');fidsrc=file(filename,'r');clusters={};#(key,[])goldstandards={};#(key,[])fo 阅读全文
摘要:
b = set([0, 1, 3, 4, 5]) c = set([3, 4, 5, 6, 7]) print b & c #求交集 print b | c #求联集 print b - c #只留下 b 独有的 阅读全文
摘要:
s1='20120125';6s2='20120216';7a=time.strptime(s1,'%Y%m%d');8b=time.strptime(s2,'%Y%m%d');9a_datetime=datetime.datetime(*a[:3]);10b_datetime=datetime.datetime(*b[:3]);11printb_datetime-a_datetime;http://blog.csdn.net/nankaihunter/article/details/5003327为了从字符串中提取时间,并进行比 阅读全文
摘要:
http://wiki.ubuntu.org.cn/Python%E6%AD%A3%E5%88%99%E8%A1%A8%E8%BE%BE%E5%BC%8F%E6%93%8D%E4%BD%9C%E6%8C%87%E5%8D%97 阅读全文
摘要:
test.py的路径在DatesManagement上一层。 阅读全文
摘要:
import re; 5 import time; 6 import datetime; 7 if(__name__=="__main__"): 8 #today=int(time.strftime("%w")); 9 10 anyday=datetime.datetime(2012,2,15).strftime("%w");11 print anyday 阅读全文
摘要:
#!/bin/sh 2 maildir=baikewaringmail 3 lastVersion=xxxxxxxxxxxxxx/lastVersion/datestr.txt 4 mydatestr=`sed -n '1p' $lastVersion` 5 echo "the datestr is $mydatestr" 阅读全文