BITPOS key bit [start] [end]

本文介绍了Redis中BITPOS命令的使用方法及其应用场景。该命令用于查找字符串中第一个被设置为1或0的bit位,并返回其位置。文章通过实例展示了如何设定查找范围,以及如何解读返回值。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

返回字符串里面第一个被设置为1或者0的bit位。

返回一个位置,把字符串当做一个从左到右的字节数组,第一个符合条件的在位置0,其次在位置8,等等。

GETBIT 和 SETBIT 相似的也是操作字节位的命令。

默认情况下整个字符串都会被检索一次,只有在指定start和end参数(指定start和end位是可行的),该范围被解释为一个字节的范围,而不是一系列的位。所以start=0 并且 end=2是指前三个字节范围内查找。

注意,返回的位的位置始终是从0开始的,即使使用了start来指定了一个开始字节也是这样。

GETRANGE命令一样,start和end也可以包含负值,负值将从字符串的末尾开始计算,-1是字符串的最后一个字节,-2是倒数第二个,等等。

不存在的key将会被当做空字符串来处理。

返回值

Integer reply

命令返回字符串里面第一个被设置为1或者0的bit位。

如果我们在空字符串或者0字节的字符串里面查找bit为1的内容,那么结果将返回-1。

如果我们在字符串里面查找bit为0而且字符串只包含1的值时,将返回字符串最右边的第一个空位。如果有一个字符串是三个字节的值为0xff的字符串,那么命令BITPOS key 0将会返回24,因为0-23位都是1。

基本上,我们可以把字符串看成右边有无数个0。

然而,如果你用指定start和end范围进行查找指定值时,如果该范围内没有对应值,结果将返回-1。

##例子

redis> SET mykey "\xff\xf0\x00"
OK
redis> BITPOS mykey 0 # 查找字符串里面bit值为0的位置
(integer) 12
redis> SET mykey "\x00\xff\xf0"
OK
redis> BITPOS mykey 1 0 # 查找字符串里面bit值为1从第0个字节开始的位置
(integer) 8
redis> BITPOS mykey 1 2 # 查找字符串里面bit值为1从第2个字节(12)开始的位置
(integer) 16
redis> set mykey "\x00\x00\x00"
OK
redis> BITPOS mykey 1 # 查找字符串里面bit值为1的位置
(integer) -1
redis>





本文作者:陈群
本文来自云栖社区合作伙伴rediscn,了解相关信息可以关注redis.cn网站。

import configparser import re, os import openpyxl,csv import glob from openpyxl.styles import PatternFill STR_SPACE1 = " " DATA_BYTE1 = 8 wb = None ws = None byteRow = "" memoRow = "" config = {} def init_config(): print("init_config call") global config con = configparser.ConfigParser() con.read("FunctionTest.ini") for sec in con.sections(): tmp = {} key: object for (key, val) in con.items(sec): tmp[key] = val config[sec] = tmp def _reduce(xls_arr): new_xls = [] for line in xls_arr: if len(new_xls) == 0: new_xls.append(line) else: find = 0 for item in new_xls: if item["DataPos"] == line["DataPos"] and item["DataLength"] == line["DataLength"] and item["CANID"] == line["CANID"]: find = 1 break if find == 0: new_xls.append(line) return new_xls # 1.1 open xlsx def s1_generate_xls_array(xls, sheet, MsgLabel, CANID, DataPos, DataLength, debug): xls_data = [] last_msg_label = "" last_can_id = "" global wb, ws wb = openpyxl.load_workbook(xls) ws = wb[sheet] steps = {} stepstart = 9 stepend = 0 if sheet == "1Trip動作確認(HV)" or sheet == "1Trip動作確認" or sheet == "1Trip動作確認(ISG)" or sheet == "CAN出力データ_HV_CSA" or sheet == "CAN出力データ_ISG_CSA": stepend = 38 elif sheet == "CAN出力データ_HV_ICS" or sheet == "CAN出力データ_ISG_ICS": stepend = 23 elif sheet == "MUTE_クリソナ検知表示": stepend = 56 elif sheet == "ソナー音量のカスタマイズ対応" or sheet == "MUTE_RCDブザー吹鳴あり": stepend = 23 for row_num, row in enumerate(ws.iter_rows(), start=1): print("%s %s %s" % (xls, sheet, row_num)) data_pos = "" data_len = "" msg_label = "" can_id = "" step1expectval = "" for (col_num, cell) in enumerate(row, start=1): idx = str(col_num) print ( str(row_num) +" "+ str(col_num) +" " + str( cell.value)) if (MsgLabel == idx): msg_label = str(cell.value) elif (CANID == idx): can_id = str(cell.value) elif (DataPos == idx): data_pos = str(cell.value) elif (DataLength == idx): data_len = str(cell.value) elif (int(idx) >= int(stepstart) and int(idx) <= int(stepend) ): if ("12" == idx): step1expectval = str(cell.value) ddd=str(cell.value) if -1 != str(cell.value).find("step"): steps[str(cell.value)] = ws.cell(row_num + 2, col_num ).value #row_num + 1 ########################### #temp = ws.cell(row_num + 1, col_num ).fill.start_color.rgb #print( "66 14 = " + str(ws.cell(66, 14 ).fill.start_color.rgb)) ########################### print("---") if msg_label and msg_label.upper() != "NONE": last_msg_label = msg_label if can_id and can_id.upper() != "NONE": last_can_id = can_id if can_id == 119: print() if data_pos and data_len: line = _check_xls_data(last_msg_label, last_can_id, msg_label, can_id, data_pos, data_len, step1expectval) if line: line["row"] = row_num xls_data.append(line) xls_data = _reduce(xls_data) if int(debug) > 0: # print("write %s %s" % (xls, sheet)) f = openpyxl.Workbook() table = f.create_sheet(sheet, 0) table.cell(row=1, column=1, value="msg_label") table.cell(row=1, column=2, value="can_id") table.cell(row=1, column=3, value="data_pos") table.cell(row=1, column=4, value="data_length") for (line_num, lines) in enumerate(xls_data, start=2): # print("write line %s" % str(line_num)) table.cell(row=line_num, column=1, value=lines["MsgLabel"]) table.cell(row=line_num, column=2, value=lines["CANID"]) table.cell(row=line_num, column=3, value=lines["DataPos"]) table.cell(row=line_num, column=4, value=lines["DataLength"]) # f.save(os.path.splitext(xls)[0] + "_lines.xlsx") f.save(sheet + "_lines.xlsx") return xls_data,steps def _check_xls_data(last_msg_label, last_can_id, msg_label, can_id, data_pos, data_len, step1expectval): lines = {} if not data_pos: return "" if not data_len: return "" if "-" == step1expectval or "ー" == step1expectval or "‐" == step1expectval or "-" == step1expectval or "―" == step1expectval: return "" if re.match("[1-3]?[0-9]\.?[0-8]?$", data_pos) and re.match("[\d][\d]?$", data_len): lines["DataPos"] = data_pos lines["DataLength"] = data_len if msg_label.upper() == "NONE": msg_label = last_msg_label if can_id.upper() == "NONE": can_id = last_can_id lines["MsgLabel"] = msg_label.upper().strip() lines["CANID"] = can_id.upper().strip() return lines else: return "" # 2.1 open log file <LOOP> # 2.2 search need line from log # 2.3 generate log array def s2_generate_log_array(): file_array = {} for sec, items in config.items(): if not re.match("log", sec, re.IGNORECASE): continue debug = items.get("debug", "") # sheet = items.get("sheetname", "") for fname in glob.glob("**/*.asc", recursive=True): farr = [] print("1/3 analyse %s" % fname) with open(fname, 'r', encoding="utf-8", errors="ignore") as f: while True: line = f.readline() if not line: break else: match1 = re.match( "\s*([\d]+\.[\d]{6})\sCANFD\s+[\d]+\s+[a-zA-Z]{2}\s+([a-zA-Z0-9]+)\s+[a-zA-Z0-9]+\s+[\d]\s[\d]\s[a-zA-Z0-9]\s+[\d]{1,2}((\s[a-zA-Z0-9]{2})+)\s", line) match2 = re.match( "\s*([\d]+\.[\d]{6})\s+[\d]+\s+([\w]+)\s+[\w]+\s+d\s[\d]\s([0-9A-F\s]+)\s", line) if match1: farr.append([item.upper().strip() for item in list(match1.groups())]) if match2: farr.append([item.upper().strip() for item in list(match2.groups())]) file_array[fname] = farr if int(debug) > 0: f = openpyxl.Workbook() count = 0 for (fname, arr) in file_array.items(): print("1/3 write " + fname) table = f.create_sheet("log_sheet" + str(count)) table.cell(row=1, column=1, value=fname) for (line_num, line) in enumerate(arr, start=2): # print("write " + str(line_num)) for (col_num, cell) in enumerate(line, start=1): table.cell(row=line_num, column=col_num, value=cell) count = count + 1 f.save("_log.xlsx") return file_array def jionLogMsgDataBin(msgdata, bytestart, bitpos, bitlength): msgdatabin = bin(int("1" + str(msgdata).replace(STR_SPACE1, ""), 16))[3:] bit_end = bytestart * DATA_BYTE1 - bitpos bit_start = bit_end - bitlength log_data_value = int(msgdatabin[bit_start:bit_end], 2) return log_data_value def _append_array(array, item): arraysize = len(array) if 0 == arraysize: array.append(item) else: #jionLogMsgDataBin(array[arraysize - 1]["data"]) if not ( array[arraysize - 1]["CANID"] == item["CANID"] and array[arraysize - 1]["dataval"] == item["dataval"] and array[arraysize - 1]["DataPos"] == item["DataPos"] and array[arraysize - 1]["DataLength"] == item["DataLength"]): array.append(item) #print(array) # 3.3 get whole data 0 0 8 8 08 00 00 00 00 c0 00 47 def s3_get_whole_data(xls_data,steps, file_array, debug): # 3.1 get line from line array allstepsdata = {} _len = len(xls_data) for (cn, xls_lines) in enumerate(xls_data): print("%d/%d anaylse" % (cn, _len)) msg_label = xls_lines["MsgLabel"] can_id = xls_lines["CANID"] # 3.2 match log from log array stepdata = {} for (fname, arr) in file_array.items(): whole_data = {} for (line_num, line) in enumerate(arr): # if len(line) < 5: # continue if line[1].zfill(3) == can_id: # print("data " + line[4]) temp = xls_lines.get("data", "") if not xls_lines.get("data", ""): xls_lines["data"] = "" if not xls_lines.get("data", ""): xls_lines["timestamp"] = line[0] xls_lines["data"] = line[2] # new_xls.append(xls_lines) xls_lines = s3_get_bytes(xls_lines) dataval = jionLogMsgDataBin(xls_lines["data"], int(xls_lines["DataPos"].split(".")[0]), int(xls_lines["DataPos"].split(".")[1]), int(xls_lines["DataLength"])) xls_lines["dataval"] = dataval if whole_data.get(msg_label, ""): whole_data[msg_label].append(xls_lines) else: whole_data[msg_label] = [] #open(msg_label + ".csv", "w") whole_data[msg_label].append(xls_lines) else: #if xls_lines.get("dataval", "") != dataval: new_lines = {} new_lines["MsgLabel"] = msg_label new_lines["CANID"] = can_id new_lines["data"] = line[2] new_lines["timestamp"] = line[0] new_lines["DataPos"] = xls_lines["DataPos"] new_lines["DataLength"] = xls_lines["DataLength"] # new_xls.append(new_lines) new_lines = s3_get_bytes(new_lines) dataval = jionLogMsgDataBin( new_lines["data"], int(new_lines["DataPos"].split(".")[0]), int(new_lines["DataPos"].split(".")[1]), int(new_lines["DataLength"])) new_lines["dataval"] = dataval if whole_data.get(msg_label, ""): _append_array(whole_data[msg_label], new_lines) # whole_data[msg_label].append(new_lines) else: whole_data[msg_label] = [] # whole_data[msg_label].append(new_lines) _append_array(whole_data[msg_label], new_lines) print("") stepdata[fname] = whole_data allstepsdata[xls_lines["MsgLabel"]+"("+xls_lines["DataPos"]+")"] = stepdata return allstepsdata ''' def _write_log(whole_data): for (label, arr) in whole_data.items(): with open(label + ".csv", "a+") as f: for new_lines in arr: f.write("%s,%s,%s,%s,%s,%s,%s\n" % (new_lines["timestamp"], #new_lines["MsgLabel"], new_lines["CANID"], new_lines["CANID"], new_lines["DataPos"], new_lines["DataLength"], new_lines.get("data", ""), new_lines.get("l8", ""), str(new_lines.get("bytes", "")))) ''' def _expand_str(data): new = "0x" + data.replace(" ", "") size = int(len(new)/2 - 1)#2->3 s16 = int(new, 16) s64 = str(bin(s16))[2:].zfill(size*8) l8 = [] for i in range(size): l8.append(s64[0 + i * 8:8 + i * 8]) return l8 def _analyse_pos(pos): match = re.match("([\d]+)\.([\d]+)", pos) if (match): return (int(match.group(1)), int(match.group(2))) else: return (int(pos), -1) def _get_bytes(l8, begin, end, leng): front = [] if 1 < begin: [front.append(l8[idx]) for idx in range(begin - 1)] else: front = [] if end == -1: front.append(l8[begin - 1][:8]) else: front.append(l8[begin - 1][:8 - end]) whole = "".join(front) return whole[len(whole) - leng:] # 3.4 get bytes 08 00 00 00 00 c0 00 47 # 3.5 put to line array def s3_get_bytes(xls_lines): msg_label = xls_lines["MsgLabel"] can_id = xls_lines["CANID"] pos = xls_lines["DataPos"] data_length = xls_lines["DataLength"] data = xls_lines.get("data", "") if not data: xls_lines["bytes"] = "" else: l8 = _expand_str(data) xls_lines["l8"] = "-".join(l8) (begin, end) = _analyse_pos(pos) strTmp = _get_bytes(l8, begin, end, int(data_length)) xls_lines["bytes"] = str(int(strTmp,2))# print("bytes " + xls_lines["bytes"]) return xls_lines # 4.1 check result # 4.2 output result def s4_check_output(sheet, steps, xls_data, data,xls): lenval = len(xls_data) steps1=steps.keys() #stepm=[] for i in steps1: #stepm.append(i) for ii in memoRow: del memoRow[0] for (cn, xls_lines) in enumerate(xls_data): print("%d/%d output" % (cn, lenval)) msg_label = xls_lines["MsgLabel"]+"("+xls_lines["DataPos"]+")" msg_label1 = xls_lines["MsgLabel"] #读取msg can_id = xls_lines["CANID"] pos = xls_lines["DataPos"] data_length = xls_lines["DataLength"] msgdict = data.get(msg_label, []) msgdict1 = msgdict.get(i,[]) # msgdict2 = msgdict1.get(msg_label1,[])# mbytes = [] if len(msgdict): for new_lines in msgdict2: if ( # new_lines["MsgLabel"] == msg_label and new_lines["CANID"] == can_id and new_lines["DataPos"] == pos and new_lines["DataLength"] == data_length): #if not new_lines.get("bytes", "") in mbytes: mbytes.append(new_lines.get("bytes", "")) if len(mbytes): #ws[str(byteRow) + str(xls_lines.get("row"))] = mbytes[0] ws[str(ii) + str(xls_lines.get("row"))] = "→".join(mbytes[0:]) break wb.save(sheet + "_result.xlsx") wb.save(xls) def getbasicsteplines(actstr, startlineinde,linesdata): stepdata = [] nextstartindex = 0 nextstartindex1=0 index = startlineinde global SELECT1 for sec, items in config.items(): if not re.match("OUT", sec, re.IGNORECASE): continue SELECT1 = items.get("select", "") shiftno = int(actstr.split(",")[0]) actflg = actstr.split(",")[1] #actno = int(actstr.split(",")[2]) while index < len(linesdata): tempstr = linesdata[index] #PTCURSFTcan,PTCURSFTDPX,PTCURSFTDPY,PTCURSFTDL if tempstr[1].strip().zfill(3).upper() == PTCURSFTcan: tempshift = jionLogMsgDataBin(tempstr[2], PTCURSFTDPX, PTCURSFTDPY, PTCURSFTDL) if(SELECT1=="PTCU" or SELECT1=="BPRND"): if tempshift == 0: print(1) else: if shiftno != tempshift: break if(SELECT1=="SFTP" or SELECT1=="XPRND" or SELECT1=="JICSXPRND" or SELECT1=="JCSAXPRND"): if shiftno != tempshift: break if actflg == "125" : if tempstr[1].strip().zfill(3).upper() == "1A0": tempshift = jionLogMsgDataBin(tempstr[2], 3, 2, 11) if tempshift == 125: index = nextstartindex break else: nextstartindex = index stepdata.append(tempstr) index = index + 1 return stepdata ,index def getmixsteplines(actstr, startlineinde,linesdata): stepdata = [] index = startlineinde nextstartindex = 0 csr_mutestr = "" global SELECT1 for sec, items in config.items(): if not re.match("OUT", sec, re.IGNORECASE): continue SELECT1 = items.get("select", "") shiftno = int(actstr.split(",")[0]) actflg = actstr.split(",")[1] actno = int(actstr.split(",")[2]) #startFlag=False #endFlag= False while index < len(linesdata): tempstr = linesdata[index] if tempstr[1].strip().zfill(3).upper() == PTCURSFTcan: tempshift = jionLogMsgDataBin(tempstr[2], PTCURSFTDPX, PTCURSFTDPY, PTCURSFTDL) if(SELECT1=="XPRND" or SELECT1=="BPRND"): if tempshift == 0: print(1) else: if shiftno != tempshift: break if(SELECT1=="SFTP" or SELECT1=="XPRND" or SELECT1=="JICSXPRND" or SELECT1=="JCSAXPRND"): if shiftno != tempshift: break if actflg == "1" and actno == 0: if tempstr[1].strip().zfill(3).upper() == "51D": tempshift = jionLogMsgDataBin(tempstr[2], 1, 7, 1) if tempshift == 1: index = nextstartindex break else: nextstartindex = index if actflg == "1" and actno != 0: if tempstr[1].strip().zfill(3).upper() == "51D": tempshift = jionLogMsgDataBin(tempstr[2],1, 7, 1) if tempshift == 1: print("1") if len(csr_mutestr) == 0: csr_mutestr = csr_mutestr + str(tempshift) else: if int (csr_mutestr[len(csr_mutestr) - 1]) != tempshift: csr_mutestr = csr_mutestr + str(tempshift) else: print("0") nextstartindex = index if len(csr_mutestr) == 0: csr_mutestr = csr_mutestr + str(tempshift) else: if int (csr_mutestr[len(csr_mutestr) - 1]) != tempshift: csr_mutestr = csr_mutestr + str(tempshift) if "0101" == csr_mutestr: index = nextstartindex break stepdata.append(tempstr) index = index + 1 return stepdata ,index def getmixsteplines1(actstr, startlineinde,linesdata): stepdata = [] index = startlineinde nextstartindex = 0 csr_mutestr = "" global SELECT1 for sec, items in config.items(): if not re.match("OUT", sec, re.IGNORECASE): continue SELECT1 = items.get("select", "") shiftno = int(actstr.split(",")[0]) actflg = actstr.split(",")[1] actno = int(actstr.split(",")[2]) #startFlag=False #endFlag= False while index < len(linesdata): tempstr = linesdata[index] if tempstr[1].strip().zfill(3).upper() == PTCURSFTcan: tempshift = jionLogMsgDataBin(tempstr[2], PTCURSFTDPX, PTCURSFTDPY, PTCURSFTDL) if(SELECT1=="XPRND" or SELECT1=="BPRND"): if tempshift == 0: print(1) else: if shiftno != tempshift: break if(SELECT1=="SFTP" or SELECT1=="XPRND" or SELECT1=="JICSXPRND" or SELECT1=="JCSAXPRND"): if shiftno != tempshift: break if actflg == "0" and actno == 1: if tempstr[1].strip().zfill(3).upper() == "51D": tempshift = jionLogMsgDataBin(tempstr[2], 2, 3, 12) if tempshift == 193: index = nextstartindex break else: nextstartindex = index if actflg == "193" and actno == 1: if tempstr[1].strip().zfill(3).upper() == "390": tempshift = jionLogMsgDataBin(tempstr[2],1, 4, 4) if tempshift == 0: index = nextstartindex break else: nextstartindex = index stepdata.append(tempstr) index = index + 1 return stepdata ,index def file_array_steps(file_array, steps): allsteps_filearray = {} stepssize = len(steps) #farrallsteps = {} startlineinde = 0 #stepdata = [] for stepindex in steps: stepdata = [] if 10 == stepssize: print("1Trip動作確認(HV) or 1Trip動作確認(ISG)") print("1Trip動作確認") #linecnt = len(file_array.values) for linekey in file_array: linesdata = file_array[linekey] if stepindex == "step1" or stepindex == "step2" : if stepindex == "step1" : stepdata, cur_lineindex =getbasicsteplines(ONETRIP_BASIC_ACT[stepindex], startlineinde, linesdata) allsteps_filearray[stepindex] = stepdata startlineinde = cur_lineindex else: stepdata= allsteps_filearray["step1"] allsteps_filearray[stepindex] = stepdata startlineinde =startlineinde else: stepdata, cur_lineindex =getbasicsteplines(ONETRIP_BASIC_ACT[stepindex], startlineinde, linesdata) allsteps_filearray[stepindex] = stepdata startlineinde =cur_lineindex elif 16 == stepssize: print("MUTE_クリソナ検知表示") for linekey in file_array: linesdata = file_array[linekey] stepdata, cur_lineindex =getmixsteplines(ONETRIP_MUTE_CRISINA[stepindex], startlineinde, linesdata) allsteps_filearray[stepindex] = stepdata startlineinde =cur_lineindex elif 5 == stepssize: print("ソナー音量のカスタマイズ対応") for linekey in file_array: linesdata = file_array[linekey] if stepindex == "step1" or stepindex == "step2" : if stepindex == "step1" : stepdata, cur_lineindex =getmixsteplines1(ONETRIP_BASIC_ACT[stepindex], startlineinde, linesdata) allsteps_filearray[stepindex] = stepdata startlineinde = cur_lineindex else: stepdata= allsteps_filearray["step1"] allsteps_filearray[stepindex] = stepdata startlineinde =startlineinde else: stepdata, cur_lineindex =getmixsteplines1(ONETRIP_BASIC_ACT[stepindex], startlineinde, linesdata) allsteps_filearray[stepindex] = stepdata startlineinde =cur_lineindex allsteps_filearray[stepindex] = stepdata return allsteps_filearray def main(): xls = "" sheet = "" global byteRow, memoRow,PTCURSFTcan,PTCURSFTDPX,DISselect,PTCURSFTDPY,PTCURSFTDL,SELECT,SELECT1,ONETRIP_BASIC_ACT,ONETRIP_MUTE_CRISINA,ONETRIP_MUTE_CRISINA1,ONETRIP_MUTE_RCD print("1/3 analyse log") file_array = s2_generate_log_array() for sec, items in config.items(): if not re.match("OUT", sec, re.IGNORECASE): continue xls = items.get("xls", "") sheet = items.get("sheetname", "") msgLabel = items.get("msglabel", "") canid = items.get("canid", "") dataPos = items.get("datapos", "") dataLength = items.get("datalength", "") debug = items.get("debug", "") byteRow = items.get("bytes", "") memoRow1 = items.get("memo", "") memoRow = memoRow1.split() PTCURSFTcan = items.get("ptcursftc", "") PTCURSFTDPX1 = items.get("ptcursftdpxx", "") PTCURSFTDPX = int(PTCURSFTDPX1) PTCURSFTDPY1 = items.get("ptcursftdpyy", "") PTCURSFTDPY = int(PTCURSFTDPY1) #Disselect = items.get("disselect", "") #DISselect = int(Disselect) PTCURSFTDL1 = items.get("ptcursftdll", "") PTCURSFTDL = int(PTCURSFTDL1) SELECT1 = items.get("select", "") if SELECT1=="XPRND" : ONETRIP_BASIC_ACT = {"step1":"0,0,0","step2":"0,0,0","step3":"8,125,0","step4":"8,0,0","step5":"4,0,0", "step6":"2,0,0","step7":"4,0,0","step8":"8,0,0","step9":"0,0,0","step10":"0,0,0"} ONETRIP_MUTE_CRISINA = {"step1":"0,0,0", "step2":"8,1,0", "step3":"8,1,1", "step4":"8,1,2", "step5":"8,1,3", "step6":"8,1,4", "step7":"4,1,0", "step8":"4,1,1", "step9":"2,1,0", "step10":"2,1,1", "step11":"4,1,0", "step12":"4,1,1", "step13":"8,1,0", "step14":"8,1,1", "step15":"0,0,0", "step16":"0,0,0"} ONETRIP_MUTE_CRISINA1 = {"step1":"2,0,1", "step2":"2,0,1", "step3":"2,193,1", "step4":"2,193,0", "step5":"2,0,0"} xls_data = [] steps = {} if not sheet: continue # 1.2 search need line from xlsx # 1.3 generate line array if xls and sheet and msgLabel and canid and dataPos and dataLength: print("2/3 analyse %s sheet %s" % (xls, sheet)) xls_data, steps = s1_generate_xls_array(xls, sheet, msgLabel, canid, dataPos, dataLength, debug) print("3/3 get data from log") allsteps_filearray = file_array_steps(file_array, steps) #data = s3_get_whole_data(xls_data, steps, file_array, debug) data = s3_get_whole_data(xls_data, steps, allsteps_filearray, debug) #_write_log(data) # s4_arr = s3_get_bytes(s3_arr) s4_check_output(sheet, steps , xls_data, data,xls) else: print("config file error") if __name__ == '__main__': init_config() main()
最新发布
07-01
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值