omSipCreator.py 文件源码

python
阅读 55 收藏 0 点赞 0 评论 0

项目:omSipCreator 作者: KBNLresearch 项目源码 文件源码
def readChecksums(fileIn):
    # Read checksum file, return contents as nested list
    # Also strip away any file paths if they exist (return names only)

    try:
        data = []
        f = open(fileIn,"r", encoding="utf-8")
        for row in f:
            rowSplit = row.split(' ', 1)
            # Second col contains file name. Strip away any path components if they are present
            fileName = rowSplit[1].strip() # Raises IndexError if entry only 1 col (malformed checksum file)!
            rowSplit[1] = os.path.basename(fileName) 
            data.append(rowSplit)    
        f.close()
        return(data)
    except IOError:
        logging.fatal("cannot read '" + fileIn + "'")
        config.errors += 1
        errorExit(config.errors, config.warnings)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号