GenerateTxt.py
import os
mkpathconfig = r"C:\Users\Public\pythonAutomationConfig"
if os.path.exists(mkpathconfig) != True:
os.makedirs(mkpathconfig)
downloadConfig = ‘downloadConfig.txt’
mailConfig = ‘mailConfig.txt’
uploadConfig = ‘uploadConfig.txt’
downloadConfigpath = os.path.join(mkpathconfig ,downloadConfig)
mailConfigpath = os.path.join(mkpathconfig ,mailConfig)
uploadConfigpath = os.path.join(mkpathconfig ,uploadConfig)
if os.path.exists(downloadConfigpath) != True:
print(111)
with open(downloadConfigpath, “w”, encoding=‘utf-8’) as f:
f.write("")
if os.path.exists(mailConfigpath) != True:
with open(mailConfigpath, “w”, encoding=‘utf-8’) as f:
f.write("")
# f.close()
if os.path.exists(uploadConfigpath) != True:
print(1111)
with open(uploadConfigpath, “w”, encoding=‘utf-8’) as f:
f.write("")
f.close()
getcelltest.py
import xlrd
from demo.src.demo.Data_Process import readSFLxlsx1
workbook = xlrd.open_workbook(r"C:\Users\E110819\Desktop\KR_2021-10-22.xlsx")
print(workbook.sheet_names()) # [u’sheet1’, u’sheet2’])
sheet1 = workbook.sheet_by_name(‘FTM’)
rows5 = sheet1.row_values(4) # 获取第五行内容
rows6 = sheet1.row_values(5) # 获取第六行内容
rows7 = sheet1.row_values(6) # 获取第七行内容
rows8 = sheet1.row_values(7) # 获取第七行内容
x = 3
numdata = []
for x in range(int(sheet1.nrows)):
if sheet1.row_values(x)[1]None:
break
if sheet1.row_values(x)[1]‘AIAIM’:
numdata.append(sheet1.row_values(x))
print(numdata)
print(str(numdata[1][2]).split(’.’)[0])
print(numdata[1][2]==‘28111’)
print(numdata[1][8])
print(int(numdata[1][8]))
print(’-----------’)
num = readSFLxlsx1()