using python i create a hash result for a file. i retrieve a hash result from somewhere else, but i have to retrieve it using stdout, and i would like to compare the two. however the retrieved stdout is retrieved as a list, and has a \n at the end. if i print it it might look, for example, like this: [6d52f\n]
i know that the problem is that if i try to add the \n to my current hash result, it automatically disregards the \n to try to compare the two (like i do below in my code), so i’m currently a bit unsure about how i can compare the two. i know the answer is probably staring me in the face, but i would appreciate any help.
my code is:
if ("%s\n" % thishash == otherhash):
print "they are the same"
else:
print "they are not the same"
Simply strip the newline from the
stdin: