I have a large csv file, and I am trying to search it for a string. and return the row and column. The code that I have so far will always return 'nope' for anything that I enter.
The code that I have so far:
def search_cell(string):
with open('aanmaningen.chr', 'r') as f:
reader = csv.reader(f)
for row in reader:
if string in row:
print(row[0])
return row[0]
else:
print('nope')
return 'nope'
For example:
When the csv file contains the string 'vve' in row 20, column 9, I want to be able to enter the string 'vve' and get the row and column number back.
Note: because the way the program i'm using exports data, it saves as a character seperated file (.chr), using the seperator and delimiter ';' essentially a .csv file with a non-standard seperator and delimiter