Python Forum

Full Version: Invalid syntax
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When i run this,


import csv

def main():
with open("battle_royale.csv") as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
for row in readCSV:
print(row)

print ("Battle Royale Tournament Registration")
options = input("Please enter your option using these keys. A: find pre-registered player , B: Find player number, C: Print player lists, Q: Quit program")
if(options == "A"):
preRegist = input("Type in what player you would like to choose.")
readCSV = csv.reader(csvfile, delimiter=',')
for row in readCSV:
for item in row:
if input == row(1)
print("You chose," + (preRegist))

print("You chose," + (preRegist))
elif(options == "B"):
playerNum = input("Type your player number.") if(options == "Q"):
print("Goodbye.")
if(options == "C"):
print("See the list of players above.")
main()

I get the error
File "main.py", line 16
if input == row(1)
^
SyntaxError: invalid syntax
Ive tried fixing the indentation, but it doesn't seem to be a indentation issue.
What am I doing wrong?

edit : added screenshot with original indentation, since it removed it when posting[attachment=1740][attachment=1740][attachment=1740][attachment=1740]
if input == row(1):
(May-13-2022, 08:29 PM)Axel_Erfurt Wrote: [ -> ]if input == row(1):

Oh I see, thanks!
Now im getting the error
File "main.py", line 17
print("You chose," + (preRegist))
^
TabError: inconsistent use of tabs and spaces in indentation
When i've only used the space bar.