python抢大麦票怎么修改代码

我用您的代码去抢大麦的票的时候,大麦的页面的立即购买那个标签已经变了,元素好像变了,怎么修改代码呀

请更细化您的问题。一般来说应该只需要更改网址,重新赋值关键字段就可以了。

不知道你这个问题是否已经解决, 如果还没有解决的话:
  • 这个问题的回答你可以参考下: https://ask.csdn.net/questions/7544112
  • 这篇博客你也可以参考下:python异常
  • 这篇博客也不错, 你可以看下python异常
  • 除此之外, 这篇博客: python从文件夹中取一定数量图片中的 最后按照上述方法写了自己想要的,按比例抽取文件夹内不同分辨率的图片,并移动到新的文件夹中 部分也许能够解决你的问题, 你可以仔细阅读以下内容或者直接跳转源博客中阅读:
    # -*- coding: utf-8 -*-
    """
    Created on Wed Oct 30 16:16:02 2019
    
    @author: Administrator
    """
    import math
    import os, random, shutil
    import os.path as osp
    from scipy import misc
    import collections
    
    data_base_dir = "D:/Cargo"  # 源图片文件夹路径
    
    tarDir = "D:/Cargo_randomselect"  # 移动到新的文件夹路径
    if not osp.exists(tarDir):
         os.mkdir(tarDir)
    
    resolution_list=[]
    resolution=[]
    filelist = os.listdir(data_base_dir)
    for file in filelist:
         if file.endswith('tif'):
              fileDir = data_base_dir + '/' + file   # 取图片的路径
              picshape = misc.imread(fileDir).shape
              resolution_list.append(str(picshape[0])+'-'+file)
              resolution.append(picshape[0])
    statistical_result = collections.Counter(resolution)
    
    for _, res in enumerate(statistical_result.keys()):
         temp=[]
         for tif in resolution_list:
              if tif.split('-')[0] == str(res):
                   temp.append(tif.split('-')[1])
    
         if res< 30:
              sample = temp
         elif res>30 and res<42:
              picknumber = math.ceil(0.6 * statistical_result[res])
              sample = random.sample(temp, picknumber) 
         elif res>42:
              picknumber = math.ceil(0.25 * statistical_result[res])
              sample = random.sample(temp, picknumber) 
         
         for name in sample:
              src = data_base_dir + '/' + name#待复制文件路径
              dst = tarDir+ '/' + name#目标路径
              shutil.copy(src,dst)
         print('selecting resolution {} picture'.format(res))
    
    
  • 您还可以看一下 黄勇老师的Python从入门到实战 基础入门视频教程(讲解超细致)课程中的 子类不能继承父类的私有···小节, 巩固相关知识点

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^