上一页 1 ··· 64 65 66 67 68 69 70 71 72 ··· 79 下一页
摘要: from HTMLParser import HTMLParserimport sysclass TitleParser(HTMLParser): def __init__(self): self.title = '' self.readingtitle=0 HTMLParser.__init__(self) def handle_starttag(self, tag, attrs): if tag == 'title': self.readingtitle=1 def handle_data(se... 阅读全文
posted @ 2012-06-14 12:45 Dsp Tian 阅读(2088) 评论(0) 推荐(0)
摘要: import os,sys, urllib2req=urllib2.Request(sys.argv[1])fd=urllib2.urlopen(req)file=open('123.html','w')while 1: data=fd.read(1024) if not len(data): break #sys.stdout.write(data) file.write(data)file.close() 阅读全文
posted @ 2012-06-13 15:35 Dsp Tian 阅读(635) 评论(0) 推荐(0)
摘要: import osfile=open("123.txt","r")for line in file.readlines(): print line,file.close()file=open("123.txt","w")file.write("sdfsdfsdf")file.close()file=open("123.txt","a")file.write("erertyerty")file.close()file=open(" 阅读全文
posted @ 2012-06-12 20:44 Dsp Tian 阅读(753) 评论(0) 推荐(0)
摘要: import mathprint 12*34+78-132/6print (12*(34+78)-132)/6print (86/40)**5print math.fmod(145,23)print math.sin(0.5)print math.cos(0.5)a=1+2c=4print "1+2=%d" %aprint "1+2=%d,%d" %(a,c) 阅读全文
posted @ 2012-06-11 22:00 Dsp Tian 阅读(601) 评论(0) 推荐(0)
摘要: import time#n=input("input a year:")n=time.localtime()[1]'''if n%400==0 or (n%4==0 and n%100!=0): print "yes"else: print "not"'''print n 阅读全文
posted @ 2012-06-11 21:48 Dsp Tian 阅读(814) 评论(0) 推荐(0)
摘要: zseven.mfunction out=zseven(nbhd) s=sum(nbhd(:))-nbhd(5); temp1=(2<=s)&(s<=6); p=[nbhd(1) nbhd(4) nbhd(7) nbhd(8) nbhd(9) nbhd(6) nbhd(3) nbhd(2)]; pp=[p(2:8) p(1)]; xp=sum((1-p).*pp); temp2=(xp==1); prod1=nbhd(4)*nbhd(8)*nbhd(2); prod2=nbhd(4)*nbhd(6)*nbhd(2); temp3=(prod... 阅读全文
posted @ 2012-05-28 14:47 Dsp Tian 阅读(2490) 评论(0) 推荐(0)
摘要: #include <iostream>#include <windows.h>int main(int argc, char* argv[]){ char VolumeInfo[100]; DWORD VolNameSize=100; DWORD VolSerialNumber; DWORD VolMaxComponentLength; DWORD VolFileSystemFlags; char FileSystemNameBuffer[100]; DWORD F... 阅读全文
posted @ 2012-05-21 20:22 Dsp Tian 阅读(769) 评论(0) 推荐(0)
摘要: clear all;close all;clc;randn('seed',0);%%一维高斯函数mu=0;sigma=1;x=-6:0.1:6;y=normpdf(x,mu,sigma);plot(x,y);figure;%%二维或多维高斯函数mu=[0 0];sigma=[0.3 0;0 0.35];[x y]=meshgrid(linspace(-8,8,80)',linspace(-8,8,80)');X=[x(:) y(:)];z=mvnpdf(X,mu,sigma);surf(x,y,reshape(z,80,80));hold on;%再生成一个mu 阅读全文
posted @ 2012-05-20 13:14 Dsp Tian 阅读(18907) 评论(0) 推荐(0)
摘要: clear all;close all;clc;randn('seed',0);%{一维情况mu=0;N=100000;S=5;data=mvnrnd(mu,S,N);me=mean(data);S2=1/N*sum((data-me).^2);%}%%二维或多维情况mu=[0 0];S=[0.3 0;0 0.35];N=10000;data=mvnrnd(mu,S,N);me=mean(data)S1=1/N*sum((data(:,1)-me(1)).^2)S2=1/N*sum((data(:,2)-me(2)).^2) 阅读全文
posted @ 2012-05-19 20:04 Dsp Tian 阅读(20236) 评论(0) 推荐(0)
摘要: clear all; close all; clc; randn('seed',0); mu1=[0 0]; S1=[0.3 0;0 0.35]; cls1_data=mvnrnd(mu1,S1,1000); plot(cls1_data(:,1),cls1_data(:,2),'+'); hold 阅读全文
posted @ 2012-05-18 22:14 Dsp Tian 阅读(9856) 评论(0) 推荐(0)
上一页 1 ··· 64 65 66 67 68 69 70 71 72 ··· 79 下一页