1

I'm very new to python. I got struck at this part while trying to work on arrays.

This the code:

with open("top10backup.txt", "r") as filestream:

   count=0

   for line in filestream:

    currentline = line.split("\t")

    print(currentline[0])

    category[count] = currentline[0]

    print(currentline[1])

    source[count] = currentline[1]

    count = count + 1

print (count)

I'm getting an error as:

category[count] = currentline[0]

Inconsistent use of tabs and spaces in indentation 

Can anyone help explain this?

SuperBiasedMan
  • 9,814
  • 10
  • 45
  • 73
Nandy
  • 13
  • 4

1 Answers1

3

Whitespace is used in Python to denote different blocks of code, so when you mix plain spaces and tab characters then it's confusing because Python isn't sure how many spaces a tab should be considered to be. If you find all your tabs and covert them to spaces (making sure to preserve the right indentation) then your code will run fine.

SuperBiasedMan
  • 9,814
  • 10
  • 45
  • 73