Hello All,
New to Python,
I keep getting an indentation error after the if (yescheck == todcheck): line. Any suggestions? As far as my python knowledge goes, I've got it correctly aligned, but clearly not.
Could some of you try running this, see if it goes?
import os
yesfile = open('C:\HeavyWeather\sp050518.txt')
todfile = open('C:\HeavyWeather\sp050519.txt')
yesdata = []
toddata = []
for line in yesfile.readlines():
yesdata.append(line)
for line in todfile.readlines():
toddata.append(line)
for position in range(len(yesdata)-1):
yesline = yesdata[position]
todline = toddata[position]
yescheck = yesline.split(",")[1]
todcheck = todline.split(",")[1]
if (yescheck == todcheck):
yesprice = float(yesline.split(",")[2])
todprice = float(todline.split(",")[2])
pricechange = todprice - yesprice
print pricechange
else:
print "Mismatch at ", yesline.split(",")[1], ", ", todline.split(",")[1]