zoukankan      html  css  js  c++  java
  • 读取Excel中的视频文件地址+requests库下载后存入本地文件夹【软件测试培训】【多测师_王sir】

    #coding=utf-8
    """
    ===========================
    Author:多测师_王sir
    Time:2020-07-27 16:27
    Wechat:xiaoshubass
    website:www.duoceshi.cn
    ===========================
    """
    
    import re
    
    class Util:
    
        @classmethod
        def read_excel(cls,num):
            data = xlrd.open_workbook('C:projectdcs3interface_autodata.xlsx')
            table = data.sheet_by_name('sheet1')
            # 传入参数0就是第一列所有行  传入参数1就是第二列所有行
            return table.col_values(num)
    
        @classmethod
        def find_baona(cls):
            new = []
            for i in range(16):
                value =  cls.read_excel(0)[i] + cls.read_excel(1)[i]
                all = re.findall(u'宝娜宝娜+',value)
                for i in all:
                    a = value.split(u'宝娜宝娜')
                    del a[0]
                    for i in a:
                        new.append(i)
            return new
    
        @classmethod
        def baonabaona(cls):
            '''
            寻找宝娜宝娜
            :return:
            '''
            for url in cls.find_baona():
                r = requests.get(url)
                filepath = r'C:projectdcs3interface_auto1_baona'
                filename = filepath + '\' + '0000' + str(cls.read_excel(1).index(url)) + 'baonabaona.wav'
                with open(filename, 'wb')as f:
                    f.write(r.content)
    
    
    if __name__ == '__main__':
        Util.baonabaona()

    运行结果如下:
    视频已经保存在本地文件夹里面了

     

  • 相关阅读:
    Using PL/SQL Control Structures
    Oracle JDBC
    PL/SQL 命名规则
    PL/SQL User's Guide and Reference:PL/SQL Architecture
    JAVA中调用存储过程和函数
    Oracle正则表达式
    java根据网卡名称获取IP
    开放通知接口,执行文件同步操作
    Jquery UI Dialog Demo
    esapi2.0GA.jar的license
  • 原文地址:https://www.cnblogs.com/xiaoshubass/p/13388057.html
Copyright © 2011-2022 走看看