new to python, help please !!
Anas Belemlih
anas.belemlih at gmail.com
Wed Nov 11 11:34:30 EST 2015
i am a beginning programmer, i am trying to write a simple code to compare two character sets in 2 seperate files. ( 2 hash value files basically)
idea is:
open both files, measure the length of the loop on.
if the length doesn't match, == files do not match
if length matchs, loop while comparing each character from each file if they match.
please tell me what i am doing wrong ? i am using python 2.7
**********************************
hash1= open ("file1.md5", "r")
line1 =hash1.read()
hash2 = open("file2.md5","r")
line2= hash2.read()
number1 = len(line1)
number2 = len(line2)
#**************************
i=0
s1=line1[i]
s2=line2[i]
count = 0
if number1 != number2:
print " hash table not the same size"
else:
while count < number1:
if s1 == s2:
print " character", line1[i]," matchs"
i=i+1
count=count+1
else
print "Hash values corrupt"
More information about the Python-list
mailing list