md5(str.encode(var1)).hexdigest() 给出十六进制值为 382fbe213f159eecf85facb256f265d0 - 如何知道 var1?
md5(str.encode(var1)).hexdigest() giving hex value as 382fbe213f159eecf85facb256f265d0 - how to know the var1?
虽然 运行 测试用例,但我的代码失败了,因为十六进制的预期值与我的答案不同。
例如,我的 ws_std 值为 13.06 即 var1
md5(str.encode(var1)).hexdigest() giving hex value as 382fbe213f159eecf85facb256f265d0
但我不确定它是否与十六进制值匹配。
在下面的代码中出现错误:-
variables = ["ws_std", "p_range", "corr", "dew_month", "max_gust_month", "max_gust_value", "avg_temp", "temp_range", "max_p_range_day", "num_days_std", "median_b_days"]
answers = [ws_std, p_range, corr, dew_month, max_gust_month, max_gust_value, avg_temp, temp_range, max_p_range_day, num_days_std, median_b_days]
answer_dict = dict()
for var, ans in zip(variables, answers):
answer_dict[var] = md5(str.encode(ans)).hexdigest()
with open('test_files/hash.pk', 'rb') as file:
hash_dict = pickle.load(file)
def test_ws_std():
assert hash_dict["ws_std"] == answer_dict["ws_std"]
错误代码:-
========================================================== FAILURES ==========================================================
________________________________________________________ test_ws_std _________________________________________________________
def test_ws_std():
> assert hash_dict["ws_std"] == answer_dict["ws_std"]
E AssertionError: assert 'c8cc550afa85...2c6946c238f36' == '382fbe213f159...facb256f265d0'
E - c8cc550afa85496c4ee2c6946c238f36
E + 382fbe213f159eecf85facb256f265d0
test.py:40: AssertionError
查看下面的评论。
输出要求:ws_std
虽然 运行 测试用例,但我的代码失败了,因为十六进制的预期值与我的答案不同。
例如,我的 ws_std 值为 13.06 即 var1
md5(str.encode(var1)).hexdigest() giving hex value as 382fbe213f159eecf85facb256f265d0
但我不确定它是否与十六进制值匹配。
在下面的代码中出现错误:-
variables = ["ws_std", "p_range", "corr", "dew_month", "max_gust_month", "max_gust_value", "avg_temp", "temp_range", "max_p_range_day", "num_days_std", "median_b_days"]
answers = [ws_std, p_range, corr, dew_month, max_gust_month, max_gust_value, avg_temp, temp_range, max_p_range_day, num_days_std, median_b_days]
answer_dict = dict()
for var, ans in zip(variables, answers):
answer_dict[var] = md5(str.encode(ans)).hexdigest()
with open('test_files/hash.pk', 'rb') as file:
hash_dict = pickle.load(file)
def test_ws_std():
assert hash_dict["ws_std"] == answer_dict["ws_std"]
错误代码:-
========================================================== FAILURES ==========================================================
________________________________________________________ test_ws_std _________________________________________________________
def test_ws_std():
> assert hash_dict["ws_std"] == answer_dict["ws_std"]
E AssertionError: assert 'c8cc550afa85...2c6946c238f36' == '382fbe213f159...facb256f265d0'
E - c8cc550afa85496c4ee2c6946c238f36
E + 382fbe213f159eecf85facb256f265d0
test.py:40: AssertionError
查看下面的评论。 输出要求:ws_std