Python - Function: get_problem_hashes
def get_problem_hashes():
"""
Function: get_problem_hashes
Summary: Walking from each problem and return a tuple
(problem_name, hash_content)
Returns: list of tuples <problem_name: string, hash_content: string>
"""
hash_pattern = re.compile("./Problem[0-9]{3}")
hashes = {}
for file_tuple in os.walk("."):
if hash_pattern.match(file_tuple[0]) and ".hash" in file_tuple[-1]:
problem = file_tuple[0]
hash_path = path.join(problem, '.hash')
hash_content = read_hashfile(hash_path)
hashes[problem.strip('./')] = hash_content
return hashes