試試這個(gè)呢~
import openpyxl
workbook = openpyxl.load_workbook('your_excel_file.xlsx')
worksheet = workbook['your_worksheet']
cell_value = worksheet['A1'].value
if cell_value == '指定內(nèi)容':
cell = worksheet['A1']
cell.protection.locked = True
workbook.save('your_excel_file.xlsx')
接口自動(dòng)化測(cè)試框架搭建(3本姥、excel的設(shè)計(jì)&excel文件的讀取)--python+HTMLTestRunnerCN+request+unittest+mock+db基于之前的兩篇文章埃仪,本篇描述下如何設(shè)計(jì)excel碗淌。 一酷誓、excel的構(gòu)建 excel主要是為了用例維護(hù)。對(duì)于不同的請(qǐng)求方式贪染,我在這里有所區(qū)分,但實(shí)際中也會(huì)根據(jù)不同的業(yè)務(wù)場(chǎng)景進(jìn)...