← Back to team overview

sikuli-driver team mailing list archive

[Question #655840]: delete a line from a text file

 

New question #655840 on Sikuli:
https://answers.launchpad.net/sikuli/+question/655840

this is my current code that reads a line from a text file then types the in the screen.  how do i delete the line from the text file?  how do i append that line into another text file?

idsList = [] # empty list/array
dir = "c:/sikuli/" # the folder, where your ids.txt is
idsFile = os.path.join(dir, "type.txt") # makes a Windows filename
f = open(idsFile) # opens ids file
for line in f.readlines(): # reads line by line
    id = line.strip() # get rid of newline
#    print id
    idsList.append(id) # add id to list/array
f.close() # close file
type(id)


Thanks very much

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.