sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #34220
Re: [Question #270082]: Calling a data from TXT file
Question #270082 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/270082
Status: Needs information => Open
Anurag gave more information on the question:
ay my file look like this.
name Anurag age 12 sex male.
name Lokesh age 24 sex male.
name Ashu age 23 sex male.
and my code looks like
for i in range(1,4):
type("PLAN"+str(i))
#afterwards i used ur codes to fetch data from file
lines = open("notepad file.txt").readlines()
for line in lines:
fields = line.split()
name = fields[1]
age = fields[3]
sex = fields[5]
type(name)
type(age)
type(sex)
break
It works fyn when i=1, it reflects name as Anurag, sex as male and age as 12.
however problem arises when i=2 and it reflect same result as Anurag, male and 12 but i required next line data(from txt file) which is lokesh, male and 24.
and so on like for i=3 it should shows ashu, male 23.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.