Hi,
I keep getting the error
Traceback (most recent call last):
File "<string>", line 11, in <fragment>
builtins.TabError: inconsistent use of tabs and spaces in indentation (<wingdb_compile>, line 11)
With the lines being

for line in datafile:
		pricedata = line.split(",")
		newdata[pricedata[0]] = pricedata[6]

I have taken out and put back the indents (tabs) for these lines several times already and still get the same error. I have tried two different IDEs (Wing and Idle) Does anyone have suggestions on what I could be missing

The full code is below.

import os

pricedata = [] 
newdata = {}
# sets up array and hash for later 
symbolfile = open("symbols.txt")
for symbol in symbolfile:
        symbol = symbol.strip() #woo woo!
        datafile = open(symbol+".csv")
        for line in datafile:
		pricedata = line.split(",")
		newdata[pricedata[0]] = pricedata[6]
	os.rename(datafile,symbol+"big.csv")	
	datafile.close()
	newfile = open(symbol+".csv",w)
	newfile.write(newdata.items())
	newfile.close()

Generally, an IDE has a "convert tabs to spaces" option which takes care of this, and I show tabs in lines 11 and 12.

So tabs are to be avoided? I thought tabs would make your indents more regular. Instead of having to count 4 spaces, you just have one tab.

Indentation is covered in the style guide. Most IDEs will also auto-indent according to python standards when editing a ".py" file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.