← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #171648]: Search inside files and get particular data

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
inFile = open("absolute-path-to-studentinfo.txt")
content = inFile.readlines() # now contains all lines in a list
inFile.close()

# I am not really sure, what you want to write to the other file

outFile = open("absolute-path-to-studentinfo_out.txt", "w")
for line in content:
    fields = line.strip().split()
    firstname = fields[0]
    lastname = fields[1]
    print("firstname = %s, lastname = %s" % (firstname, lastname)) 
    outFile.write("firstname = %s, lastname = %s\n" % (firstname, lastname)) 
outFile.close()

look question https://answers.launchpad.net/sikuli/+question/169128 for
info links

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