← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #236949]: How to compare the string from two different text file?

 

Question #236949 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/236949

    Status: Open => Answered

RaiMan proposed the following answer:
ok, finally understood ;-)

def getName(file):
    f = open(file)
    name = ""
    for line in f.readlines():
        if line.count("Student Name") == 0: continue
        (head, name) = line.split("-")
        name = name.strip()
        break
    f.close()
    return name

file1 = "some absolute file name"
file2 = "some other absolute file name"

name1 = getName(file1)
name2 = getName(file2)
if name1 == name2:
    print "we have a match:", name1, "in:" file1, "and:", file2
else:
    print "different names:", name1, name2, "in:" file1, "and:", file2

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.