python skipping lines?

lisa.engblom at gmail.com lisa.engblom at gmail.com
Mon Nov 27 19:58:40 CET 2006


thats easy enough to solve

"""test text.py
for playing around with my text editing task
"""

UnitList = open('/Python25/working/FacList.txt', 'r')
RawData = open('/Python25/working/data.txt', 'r')
Output = open('/Python25/working/output.txt', 'a')

def PullHourlyData(filename, facility, unit):
        for line in filename:
                data = line.split('","')
                CurrentFacility = data[1]
                CurrentUnit = data[3]
                CurrentSO2Mass = data[9]            #in lb/hour
                #print CurrentFacility
                #print CurrentUnit

                if facility == CurrentFacility and unit == CurrentUnit:

                        #print >> Output, '"%s", "%s", "%s"' %
(CurrentFacility, CurrentUnit, CurrentSO2Mass)
                        print '"%s", "%s", "%s"' % (CurrentFacility,
CurrentUnit, CurrentSO2Mass)
                else:
                        print facility
                        print unit
                        print CurrentFacility
                        print CurrentUnit
                        print "\n"


counter = 0

for combos in UnitList:
        print counter
        FandU = combos.split('","')
        #print combos
        FacilityName = FandU[0]
        UnitName = FandU[1]
        #print FacilityName
        #print UnitName
        FacilityName = FacilityName.strip('"')
        UnitName = UnitName.strip('",\n')
        print FacilityName
        print UnitName

        PullHourlyData(RawData, FacilityName, UnitName)
        counter += 1


UnitList.close()
RawData.close()
Output.close()
print "Done!"

Jordan Greenberg wrote:
> lisa.engblom at gmail.com wrote:
> > Hi,
> <SNIP>
> > Any ideas of what could be the problem?
> >
>
> Hard to say without seeing your code.
>
> Jordan Greenberg
> 
> -- 
> Posted via a free Usenet account from http://www.teranews.com




More information about the Python-list mailing list