sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #27622
[Question #252926]: details about coded lines
New question #252926 on Sikuli:
https://answers.launchpad.net/sikuli/+question/252926
Hello, well i have tested the code below which does the following :
the data.configure.camera=true argument is changed into data.configure.camera=false in an Instructions file.
However , i would like to know if someone can describe the code lines below in order that i can understand properly which coded line does what please?
Thanx.
Here is the code below which i used:
def getInstructions(inp): --line 1 does what ?
store = {} --line 2 does what ?
try: -- line 3 does what ?
configInput = open(inp) --line 4 does what ?
for line in configInput.readlines():
(key, val) = line.strip().split("=")
store[key.strip()] = val.strip()
configInput.close()
except: pass
return store
def putInstructions(out, store):
configOutput = open(out, "w")
for key in store.keys():
line = key + "=" + store[key] + "\n"
configOutput.write(line)
configOutput.close()
fInstructions = "C:\\Users\\Richi\\Astrator\\Instructions.txt"
# step 1: fetch current instructions
instructions = getInstructions(fInstructions)
# step 2: modify instructions
instructions["data.configure.camera"] = "false"
# one might add additional instructions
instructions["data.configure.newoption"] = "true"
# step 3: write the instructions back to file
putInstructions(fInstructions, instructions)
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.