My code:
import csv
def searchProxy():
csv_file = csv.reader(open ('C:/Users/Keanu/Documents/CSV/07-12-report.csv', 'r'))
cardIdentifier = input('Enter proxy')
for row CardIdentifier in csv_file:
if Card Identifier == row[0]:
print(row)
print ('Enter to search card identifier')
src = int(input ("Enter here: "))
I'm getting this SyntaxError
:
File "C:\Users\Keanu\Documents\PythonProjects\main.py", line 8
for row CardIdentifier in csv_file:
^
SyntaxError: invalid syntax
Process finished with exit code 1
CardIdentifier
is the name of a column in my csv file, and I'm search through each row. What could be causing the error?
You can try this:
def searchProxy():
csv_file = csv.reader(open ('C:/Users/Keanu/Documents/CSV/07-12-report.csv', 'r'))
cardIdentifier = input('Enter proxy')
for row in csv_file:
if cardIdentifier == row[0]: #I don't think row[0] as well I think it is row only
print(row)
You aren't supposed to use space between variable name! You have so, many typos errors in your code as well.
You had wrote somewhere cardIdentifier
and somewhere CardIdentifier
which is completely different thing. Just remember main/one things, you can't give space in variable name, like test csv
you can either do test_csv
or testcsv
, But not space!