lundi 13 mai 2019

Every time I click run, I am told there in a index error, it says "IndexError: list index out of range"

def main():

import csv
info = (input("Enter in your gamertag and we'll tell you your number"))
found = False

with open("battle_royale.csv") as csvfile:
    readCSV = csv.reader(csvfile, delimiter=',')
    for row in readCSV:
            if(row[0]==info):
                    found = True
                    print("We found your gamertag, you number is " + str(row[3]) + "")
                    break
    if not found:
             print("Looks like you're not registered")

csvfile.close()

main()

Row 12 is right under the found = true statement, that apears to be were the error is.

Aucun commentaire:

Enregistrer un commentaire