下面是内存溢出 jb51.cc 通过网络收集整理的代码片段。
内存溢出小编现在分享给大家,也给大家做个参考。
#本代码获取百度乐彩网站上的信息,只获取最近100期的双色球#http://trend.lecai.com/ssq/redBaseTrend.action?recentPhase=100&onlyBody=false&phaSEOrder=up&coldHotOrder=numberimport urllib.requestfrom bs4 import BeautifulSoupimport randomere_hitList = []hitList = []def getSSQ100(): site = 'http://trend.lecai.com/ssq/redBaseTrend.action?recentPhase=100&onlyBody=false&phaSEOrder=up&coldHotOrder=number' page = urllib.request.urlopen(site) HTML = page.read(); soup = BeautifulSoup(HTML.decode("utf-8")) hhList = soup.find_all("td",class_="red_ball") blueList = soup.find_all("td",class_="blue_ball") num = 0 count = 0 for tag in hhList: global hitList global ere_hitList if num < 6: hitList.append(tag.contents[0]) if count == 599: ere_hitList.append(hitList) hitList = [] elif num == 6 : ere_hitList.append(hitList) hitList = [] num = 0 hitList.append(tag.contents[0]) num+=1 count+=1 num = 0 for subList in ere_hitList: subList.append(blueList[num].contents[0]) num+=1 def chooseSSQ(): hhList = [] lhList = [] ylhList = ['01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33'] yllList = ['01','16'] ylhrList = [] yllrList = [] num = 0 for curList in ere_hitList: for value in curList: num+=1 for ylval in ylhList: if ylval == value and len(curList) == num: yllrList.append(value) elif ylval == value and len(curList) != num: ylhrList.append(value) num = 0 print("红号:",len(ylhrList),"蓝号:",len(yllrList)) if len(ylhrList) == 600 and len(yllrList) == 100: lh = random.randint(0,99) lhList.append(ere_hitList[lh][6]) while len(hhList) < 6: hh = random.randint(0,99) hhs = random.randint(0,5) hhList.append(ere_hitList[hh][hhs]) hhList = List(set(hhList)) elif len(ylhrList) == 600 and len(yllrList) != 100: lh = random.randint(0,len(yllrList)) lhList.append(yllrList[lh]) lh = random.randint(0,15) lhList.append(yllList[lh]) while len(hhList) < 6: hh = random.randint(0,5) hhList.append(ere_hitList[hh][hhs]) hhList = List(set(hhList)) elif len(ylhrList) != 600 and len(yllrList) == 100: lh = random.randint(0,99) lhList.append(lh) while len(hhList) < 3: hh = random.randint(0,len(ylhrList)) hhList.append(ylhrList[hh]) hhList = List(set(hhList)) while len(hhList) < 6: hh = random.randint(0,len(ylhList)) hhList.append(ylhList[hh]) hhList = List(set(hhList)) elif len(ylhrList) != 600 and len(yllrList) != 100: lh = random.randint(0,15) lhList.append(yllList[lh]) while len(hhList) < 3: hh = random.randint(0,len(ylhList)) hhList.append(ylhList[hh]) hhList = List(set(hhList)) print("根据前100期双色球中奖号码,本人预测下一期中奖号码是,红号:",hhList,",蓝号:",lhList)if __name__ == '__main__': getSSQ100() chooseSSQ()
以上是内存溢出(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
总结以上是内存溢出为你收集整理的爬前100期双色球中奖号码,从中随机出下一期中奖号码全部内容,希望文章能够帮你解决爬前100期双色球中奖号码,从中随机出下一期中奖号码所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)