sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #31198
Re: [Question #263857]: how to read single column from csv file using python in sikuli
Question #263857 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/263857
Status: Needs information => Open
Kartheek gave more information on the question:
Here is the script,
############
import csv
csvFile = csv.reader(open("D:\\Sikuli\\example1.csv", "rb"))
nR = 1
nC = 1
mycsv = [] # empty list
for row in csvFile:
mycsv.append(row)
# row nR, column nC
print mycsv[nR][nC]
#gives you the field content of column nC in row nR
# first field in first row:
mycsv[1][1]
#you might now of course convert the list, so a list row contains all fields of all rows (mycsv inverted)
mycsvCols = []
for nC in range(len(mycsv[0])):
mycsvCols.append([])
for nR in range(len(mycsv)):
mycsvCols[nC].append(mycsv[nR][nC])
#now the access is:
print mycsv[nR][nC]
################
--> my requirement is to print specific row and column
--> script is not executing and also it is not showing any error
Below i'm pasting My csv file (and it is separated by comma's):
Presedence Sno STP-testcaseno Test_id Scenario Simulator Comport
0 1 STP-GPSBL-001 SimZen-001 general SimZen com1
1 2 STP-GPSBL-002 SimZen-002 general SimZen com2
1 3 STP-GPSBL-003 Simplex-003 gpsblhsiura1 Simplex com1
0 4 STP-GPSBL-004 SimZen-004 gpsblhsiura1 SimZen com1
1 5 STP-GPSBL-005 Accord-005 general1 Accord com3
0 6 STP-GPSBL-006 Ifen-006 general1 Ifen com1
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.