前言
我是一名学生工作者,被要求更新从中提取数据的脚本和excel书,并安排它符合预定义的格式。在我看来,我的内部for循环存在问题。它会卡在第一行,永远不会进入下一行。
循环问题:
private static void verifyDirsAreEqual(Path one, Path other) throws IOException {
Files.walkFileTree(one, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file,
BasicFileAttributes attrs)
throws IOException {
FileVisitResult result = super.visitFile(file, attrs);
// get the relative file name from path "one"
Path relativize = one.relativize(file);
// construct the path for the counterpart file in "other"
Path fileInOther = other.resolve(relativize);
log.debug("=== comparing: {} to {}", file, fileInOther);
byte[] otherBytes = Files.readAllBytes(fileInOther);
byte[] thisBytes = Files.readAllBytes(file);
if (!Arrays.equals(otherBytes, thisTypes)) {
throw new AssertionFailedError(file + " is not equal to " + fileInOther);
}
return result;
}
});
}
整个剧本:
alt3_sheet = book.sheet_by_name("alt3_specific")
for row in range(3, 729 ):
#if uniqueID not in alt3_specific:
temp = []
temp.append(alt3_sheet.cell(row, 12).value) # access
temp.append(alt3_sheet.cell(row, 13).value) # catch
temp.append(alt3_sheet.cell(row, 14).value) # CPUE
temp.append(alt3_sheet.cell(row, 15).value) # anglerdays
temp.append(alt3_sheet.cell(row, 16).value) # visits
temp.append(alt3_sheet.cell(row, 17).value) # sheeppue
temp.append(alt3_sheet.cell(row, 18).value) # moosepue
temp.append(alt3_sheet.cell(row, 19).value) # cariboupue
temp.append(alt3_sheet.cell(row, 20).value) # king
alt3_specific[uniqueID] = temp
任何帮助都表示赞赏我已经盯着这几个小时了,我确信这个错误很明显,但我可以看到它。