免费爱碰视频在线观看,九九精品国产屋,欧美亚洲尤物久久精品,1024在线观看视频亚洲

      python 將cookie寫入excel并讀取

      # — coding: utf-8 –# @Time : 2022/6/20 11:05import xlrd, xlwt, osexcel_path = os.path.join(os.path.abspath(__file__), “../data/zentao_login_cookies.xlsx”)class ExcelUtils: def __init__(self, excel_path=excel_path): self.excel_path = excel_path def write_excel(self): wb = xlwt.Workbook() sheet = wb.add_sheet(‘zentao_cookies’) row_list = [[“name”, “value”, “Domain”, “path”], [‘zentaosid’, ‘l97vmm6ovptiq8c47s6unb2e31’, ‘xx.107.178.45’, ‘/’], [‘theme’, ‘default’, ‘xx.107.178.45’, ‘/zentao/www/’], [‘device’, ‘desktop’, ‘xx.107.178.45’, ‘/zentao/www/’], [‘lang’, ‘zh-cn’, ‘xx.107.178.45’, ‘/zentao/www/’]] for i in range(0, len(row_list)): data = row_list[i] for j in range(0, len(data)): sheet.write(i, j, data[j]) wb.save(self.excel_path) def read_excel(self): wk = xlrd.open_workbook(self.excel_path) sheet = wk.sheet_by_name(“zentao_cookies”) rows = sheet.nrows cols = sheet.ncols cookies_list = [] for i in range(cols + 1): cookie_list = [] for j in range(rows – 1): cookie_list.append(sheet.cell_value(i, j)) cookies_list.append(cookie_list) return cookies_list def list_to_change_dic(self): c= [] for i in range(0, 4): b = [] for j in range (1,5): a = {self.read_excel()[0][j-1]: self.read_excel()[i+1][j-1]} b.append(a) c.append(b) return cif __name__ == ‘__main__’: ecl_util = ExcelUtils() # ecl_util.write_excel() # ecl_util.read_excel() # for i in range(0,4): # print(ecl_util.list_to_change_dic()[0])

      鄭重聲明:本文內(nèi)容及圖片均整理自互聯(lián)網(wǎng),不代表本站立場(chǎng),版權(quán)歸原作者所有,如有侵權(quán)請(qǐng)聯(lián)系管理員(admin#wlmqw.com)刪除。
      用戶投稿
      上一篇 2022年6月23日 06:24
      下一篇 2022年6月23日 06:24

      相關(guān)推薦

      聯(lián)系我們

      聯(lián)系郵箱:admin#wlmqw.com
      工作時(shí)間:周一至周五,10:30-18:30,節(jié)假日休息