android游戏开发教程_大连网页设计_郑州网站设计_视频app开发 学生用户登录后可以查看课程表信息。界面如下图所示:

">

深圳网站建设公司

南宁网站推广、网站建设计划书、永久使用、不限域名、福州做网站

珠海建网站?

android游戏开发教程_大连网页设计_郑州网站设计_视频app开发

const.citykey=['kunming','lijiang','xishuangbanna','baoshan','yuxi','qujing','puer','dehong','lincang','zhaotong','dali','quxiong','honghe','wenshan','nujiang','diqing']def getHTMLText(url): #获取网页源代码try:r = requests.get(url, timeout=300)r.raise_for_status() # 如果状态码不是200,产生异常r.encoding = 'utf-8' # 字符编码格式改成 utf-8return r.textexcept:# 异常处理return " error "def findHTMLText(text):#获取指定的内容soup = BeautifulSoup( text, "html.parser" ) #返回BeautifulSoup对象return soup.find_all(string=re.compile('^\d{1,4}$|^[\u4e00-\u9fa5]|(市)|(出院)|(例)|(人)|(年)|(月)|(日)|(时)')) # 结合正则表达式,实现字符串片段匹配def getCONTENT(url): #获取匹配的数据内容text = getHTMLText(url) # 获取html文本内容text = re.sub('\r|\n|\t', '', text)res = findHTMLText(text) # 匹配结果i=0for r in res:s = re.sub('\xa0','',r)res[i] = "".join(s.split())i+=1return resdef yunnanold(list,data=['云南省'],citylist=const.citylist):#老版本使用,数字没有分开的网页内容提取text = max(list,key=len) #提取字符串最长的列表值print(text)for k in citylist:if not k in text:result = k + '0' + '例'data.append(result)continueif k in '无死亡病例':if '无死亡病例' in text:result = '无死亡病例'data.append(result)continueif k=='医学观察':num = getText.get_str_btw(text, k, '人')result = k + num + '人'else:num = getText.get_str_btw(text, k, '例')result = k + num + '例'data.append(result)return datadef cleandataold(city,list,data=['云南省']): #依据城市删选出每个城市的病例数,默认是云南省new = False #是否是新增yfind = False #是否找到城市place = ''for l in list:if '新增' in l:new = Trueif '确诊' in l:new = Falseif city in '无死亡' and '无死亡' in l:result = '无死亡病例'data.append(result)breakif city in l:if new :continue#place = city + '新增'else:place = cityyfind = Trueif l.isdigit() and yfind :result = place+l+'例'yfind = Falsedata.append(result)if not new:return datareturn datadef cleandata(city,list,data=['云南省']): #依据城市删选出每个城市的病例数,默认是云南省citykey = cityyfind = True #是否找到城市数据cityfind = True #是否找到该城市place = ''text='' #将列表合并为一个字符串for l in list:text=text+l#print(text)while not getText.is_number(getText.get_str_btw(text,citykey,'例')):if getText.get_str_btw(text, citykey, '例').strip() == '':cityfind=Falsebreakpar = text.partition(citykey)text=par[2]if cityfind:num1 = getText.get_str_btw(text, citykey, '例')textpart = text.partition(citykey)[2]while not getText.is_number(getText.get_str_btw(textpart, citykey, '例')):if getText.get_str_btw(textpart, citykey, '例').strip() == '':yfind = Falsebreakpar = textpart.partition(citykey)textpart = par[2]if yfind: # 判断同一城市是否找到第2个数据num2 = getText.get_str_btw(textpart, citykey, '例')else:num2 = 0if int(num1) > int(num2):num = num1else:num = num2else:num = 0virus = citykey + str(num) + '例'#print(virus)data.append(virus)return datadef yunnan(list,data,citylist=const.citylist): #获取所有列表类型的数值print('getdynamicdata.yunnan()')for city in citylist:result = cleandata(city, list,data)return resultdef getlist(urllist, citylist=const.citylist,mutilist = ['云南省']):#默认是云南# urllist = getvirusdynamic.getdatalist() #直接获取从网页获取链接#print(urllist)for u in urllist:urlone = u[2]if not '肺炎疫情情况' in u[1]: #筛选只显示疫情情况continueres = getCONTENT(urlone)ldate = getText.get_str_btw(u[0],'[',']')#获取时期'''if datetime.datetime.strptime(ldate,'%Y-%m-%d')>datetime.datetime.strptime('2020-1-30','%Y-%m-%d'):print('new')mutilist = yunnan(res,mutilist,citylist)else:print('old')mutilist = yunnanold(res, mutilist, citylist)'''mutilist = yunnan(res, mutilist, citylist)mutilist.append(u[0]) #添加日期return mutilistdef getoldlinkdata():record = Total.objects.order_by('id').last()print(record.date_record)return record.date_recorddef geturllistfromdatabase():print('从数据库读取链接列表')urllist = []dayd = getoldlinkdata()print('fail')#list = Linktable.objects.filter(linkdate__gte = datetime.datetime.strptime('2020-2-9','%Y-%m-%d')).order_by("-id").all()#读取全部数据list = Linktable.objects.filter(linkdate__gte=dayd).order_by("-id") # 读取全部数据d=datetime.datetime.strptime('2020-1-20','%Y-%m-%d')for l in list:if not '肺炎疫情情况' in l.linktitle:continueif d == l.linkdate:continued=l.linkdateu = ('['+str(l.linkdate)+']', l.linktitle, l.linkvule)urllist.append(u)#urllist.reverse()print('打印geturllistfromdatabase()')print(urllist)return urllistdef getvirusdata(): #最终输入函数#云南省卫计委:#url = 'http://ynswsjkw.yn.gov.cn/wjwWebsite/web/col?id=UU157976428326282067&pId=UU145102906505319731&cn=xxgzbd&pcn=ztlm&pid=UU145102906505319731'urllist = geturllistfromdatabase()#urllist = [('[2020-2-4]','云南省卫生健康委员会关于云南省新型冠状病毒感染的肺炎疫情情况的通报','http://ynswsjkw.yn.gov.cn/wjwWebsite/web/doc/UU157987576940339792')]datalist= getlist(urllist, citylist=const.citylist, mutilist=['云南省']) # 默认是云南return datalistdef getvirusdata00():#单页1月31号之前的url1 = 'http://ynswsjkw.yn.gov.cn/wjwWebsite/web/doc/UU158004254342965198'kk = getCONTENT(url1)#print(kk)# new=cleandata(const.citylist,kk,data=['云南省'])datalist = yunnanold(kk, data=['云南省'], citylist=const.citylist)datalist.append('[2020-2-7]')# old=cleandataold(const.citylist,kk,data=['云南省'])#print(datalist)return datalistdef getvirusdata11():#单页1月31号之后的url1 = 'http://ynswsjkw.yn.gov.cn/wjwWebsite/web/doc/UU158101410083798470'kk = getCONTENT(url1)#print(kk)# new=cleandata(const.citylist,kk,data=['云南省'])datalist = yunnan(kk, data=['云南省'], citylist=const.citylist)datalist.append('[2020-2-6]')# old=cleandataold(const.citylist,kk,data=['云南省'])#print(datalist)return datalist 安卓软件开发公司成都app开发多少钱长沙市网站建设公司上海网页设计公司福田网页设计上海门户网站制作上海企业建站网站建设简介微信开发者工具乐清网站制作公司郴州网站优化网站推广建站网络建站深圳app开发价格网站制作推广免费做网站的网站凯里网站开发软件系统定制开发东莞建网站网站设计书安徽网页设计网站建设服务网页制作东莞扬中网站建设北京制作网页设计商丘网站优化怎样制作网页龙岗网络推广ios开发上海网页设计长沙建站公司

猜你喜欢