在Prisons.py中
Read file func下新增方法:
# 检查数据是否已经被读取过
def isUsed():
# 检查'监所'位置是否被找到
if Read_File_PrisonsPositionRow == 0 and Read_File_PrisonsPositionCol == 0:
raise Exception('未找到"监所"位置.')
if getCellValue(Read_File_PrisonsPositionRow - 1, Read_File_PrisonsPositionCol) == '已读取':
print('该数据已统计.请勿重复统计')
return True
else:
return False
def writePrisonsUsedFlag():
writeReadFileValue(Read_File_PrisonsPositionRow - 1, Read_File_PrisonsPositionCol, '已读取')
以下为MyMain.py代码:
from Prisons import *
def main():
print('Main is running')
# getAllPrisonsElementList()
# showPrisonsElementList()
# writeValue('每日', 0, 3, '541打野')
# getTimeValue()
# a,b = getWriteFileRowRange()
# print('%d %d'%(a,b))
# print('坐标 Row: %d Col: %d 的值为 %s'%(0 + 1, 3 + 1, getWriteFileCellValue(0,3)))
# print('坐标 Row: %d Col: %d 的值为 %s' % (1 + 1, 3 + 1, getWriteFileCellValue(1, 3)))
getAllPrisonsElementList()
if not isUsed():
writePrisonsUsedFlag()
for element in PrisonsElementList:
analysisPrisonsElement(element)
if __name__ == '__main__':
main()