CS作业代写 程序 代码、金融、统计、物理、数学、EE、论文、essay案例
-
[Python]代码 “` python 简单小程序 from datetime import datetime import calendar def getMonths(): d = datetime.now() c = calendar.Calendar() year = d.year month = d.month if month == 1 : month = 12 year -= 1 else : month -= 1 months = calendar.monthran … 继续阅读“Python获取上一个月的天数”
:
-
from html.parser import HTMLParser from urllib.request import urlopen from urllib import parse class LinkParser(HTMLParser): def handle_starttag(self, tag, attrs): if tag == ‘a’: for (key, value) in attrs: if key == ‘href’: newUrl = parse.urljoin(sel … 继续阅读“python精简版搜索引擎”
:
-
python编写的用于测试网站访问速率的代码片段,可以输出打开某url的时间,访问100次的平均时间,最大时间和最小时间等等“`python def Process(url,n): minSpan = 10.0 maxSpan = 0.0 sumSpan= 0.0 over1s = 0 for i in range(n): startTime = datetime.datetime.now() try: res = urllib2.urlopen(url,timeout=10) ex … 继续阅读“python编写的用于测试网站访问速率的代码片段”
:
-
class JianKong(): ”’查询IDC信息,封ip和过白名单”’ def __init__(self): pass @classmethod def ip_verify(cls,str): ‘验证IP地址规范’ pattern=re.compile(‘(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1 … 继续阅读“python 匹配IP和匹配域名”
:
-
#!/usr/bin/env python #coding: utf-8 import md5 import os from time import clock as now def getmd5(filename): file_txt = open(filename, ‘rb’).read() m = md5.new(file_txt) return m.hexdigest() def main(): path = u’C:\\aa\bb\cc\dd’ all_md5 = {} all_siz … 继续阅读“Python删除同一个文件夹下的重复文件代码”
:
-
插入排序的基本概念:有一个已经有序的数据序列,要求在这个已经排好的数据序列中插入一个数,但要求插入后此数据序列仍然有序,这个时候就要用到一种新的排序方法——插入排序法,插入排序的基本操作就是将一个数据插入到已经排好序的有序数据中,从而得到一个新的、个数加一的有序数据,算法适用于少量数据的排序,时间复杂度为O(n^2)。是稳定的排序方法。插入算法把要排序的数组分成两部分:第一部分包含了这个数组的所有元素,但将最后一个元素除外,而第二部分就只包含这一个元素。在第一部分排序后,再把这个最后元素插入到此 … 继续阅读“python插入排序算法”
:
-
#!/usr/bin/python ”’ ”’ import gtk.gdk import gtk import glib class MyRect(): def __init__(self, x = 0, y = 0, w = 0, h = 0): self.x = x self.y = y self.w = w self.h = h def __init__(self, x, y): self.x = min(int(x.x), int(y.x)) self.y = min(int(x. … 继续阅读“python linux下python抓屏小程序”
:
-
mport urllib2 from BeautifulSoup import BeautifulSoup # get the proxy of = open(‘proxy.txt’, ‘w’) for page in range(1,50): url = ‘http://www.xicidaili.com/nn/%s’ %page user_agent = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, … 继续阅读“python爬虫-爬取代理IP并通过多线程快速验证”
:
-
python统计文本字符串里面单词出现的频率“`python word frequency in a text tested with Python24 vegaseat 25aug2005 Chinese wisdom … str1 = “””Man who run in front of car, get tired. Man who run behind car, get exhausted.””̶ … 继续阅读“python统计文本字符串里面单词出现的频率”
:
-
import poplib, string PopServerName = "mail.yourserver.com" PopServer = poplib.POP3(PopServerName) print PopServer.getwelcome() PopServer.user(‘yourName’) PopServer.pass_(‘yourPass’) r, items, octets = PopServer.list() msgid, size = string. … 继续阅读“python登录pop3邮件服务器接收邮件”
: