troubleshooting Question

Help with a Python script converting xml to csv

Avatar of Scott Abraham
Scott AbrahamFlag for United States of America asked on
XMLPython
3 Comments1 Solution743 ViewsLast Modified:
I have an xml file that I want to extract data from and put it into a CSV file.  I have most the script working fine.  My problem is each row or data point needs a time stamp.  In the xml the times are given as a start and stop time with the number of time intervals/data points given instead of time.

For Instance:
<ContiguousIntervalSet NumberOfReadings="24">
          <TimePeriod StartTime="2017-03-21T00:00:00-05:00" EndTime="2017-03-22T00:00:00-05:00" />
This tells me that their are 24 reads over 24 hours, each one being at the top of the hour.
Here is what the reads look like:
 <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
This tells me the 24 data points for the time frame, but no date/time.

This tells me what item and point I am looking for:
<ChannelID ServicePointChannelID="73825602:101" />
Ideally in the output file in this instance it would be like this:
Value,EntityId,ReadingTime,ServicePointChannelID
1,73825602,2017-03-21T00:00:00-05:00,101
1,73825602,2017-03-21T01:00:00-05:00,101
1,73825602,2017-03-21T02:00:00-05:00,101
1,73825602,2017-03-21T03:00:00-05:00,101
1,73825602,2017-03-21T04:00:00-05:00,101
1,73825602,2017-03-21T05:00:00-05:00,101
1,73825602,2017-03-21T06:00:00-05:00,101
1,73825602,2017-03-21T07:00:00-05:00,101
1,73825602,2017-03-21T08:00:00-05:00,101
1,73825602,2017-03-21T09:00:00-05:00,101
1,73825602,2017-03-21T10:00:00-05:00,101
1,73825602,2017-03-21T11:00:00-05:00,101
1,73825602,2017-03-21T12:00:00-05:00,101
1,73825602,2017-03-21T13:00:00-05:00,101
1,73825602,2017-03-21T14:00:00-05:00,101
1,73825602,2017-03-21T15:00:00-05:00,101
1,73825602,2017-03-21T16:00:00-05:00,101
1,73825602,2017-03-21T17:00:00-05:00,101
1,73825602,2017-03-21T18:00:00-05:00,101
1,73825602,2017-03-21T19:00:00-05:00,101
1,73825602,2017-03-21T20:00:00-05:00,101
1,73825602,2017-03-21T21:00:00-05:00,101
1,73825602,2017-03-21T22:00:00-05:00,101
1,73825602,2017-03-21T23:00:00-05:00,101
I can get it to output:
Value,EntityId,ServicePointChannelID
1.0,73825602,101
1.0,73825602,101
1.0,73825602,101
1.0,73825602,101
1.0,73825602,101
1.0,73825602,101
1.0,73825602,101
1.0,73825602,101
1.0,73825602,101
1.0,73825602,101
1.0,73825602,101
1.0,73825602,101
1.0,73825602,101
1.0,73825602,101
1.0,73825602,101
1.0,73825602,101
1.0,73825602,101
Here is a sample of the XML file with two time periods:
<?xml version="1.0" encoding="us-ascii" standalone="yes"?>
<MeterReadingDocument xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <ReadingStatusRefTable>
    <ReadingStatusRef Ref="1">
      <UnencodedStatus SourceValidation="NV">
        <StatusCodes>
          <Code>ESTIMATED</Code>
          <Code>ESTNUMREPLACE</Code>
          <Code>ESTUNSCALED</Code>
          <Code>GAP</Code>
          <Code>NV</Code>
          <Code>VEESET1PV</Code>
          <Code>VEESET2NV</Code>
          <Code>VEESET3NV</Code>
        </StatusCodes>
      </UnencodedStatus>
    </ReadingStatusRef>
	<!--DELETED LARGE AMOUNT OF ReadingStatusRef inumerations -->
  </ReadingStatusRefTable>
  <Header>
    <IEE_System Id="REDACTED" />
    <Creation_Datetime Datetime="2017-03-22T09:09:21Z" />
    <Timezone Id="UTC" />
    <Path FilePath="REDACTED" />
    <Export_Template Id="REDACTED" />
    <CorrelationID Id="" />
  </Header>
  <ImportExportParameters CreateResubmitFile="false" CreateReadingGroupForRegisterReads="true">
    <DataFormat ReadingTimestampType="MeterDefault" DSTTransitionType="REDACTED" />
  </ImportExportParameters>
  <Channels>
    <Channel StartDate="2017-03-21T00:00:00-05:00" EndDate="2017-03-22T00:00:00-05:00" TimeZone="CentralUS" IsRegister="false" MarketType="Electric" IntervalLength="60" NumberOfDials="-1" PulseMultiplier="1" PressureCompensationFactor="1" IsReadingDecoded="true" ReadingsInPulse="false">
      <ChannelID ServicePointChannelID="73825602:101" />
      <ContiguousIntervalSets>
        <ContiguousIntervalSet NumberOfReadings="24">
          <TimePeriod StartTime="2017-03-21T00:00:00-05:00" EndTime="2017-03-22T00:00:00-05:00" />
          <Readings>
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
            <Reading Value="1.0" StatusRef="1" />
          </Readings>
          <ExportRequest RequestID="702" EntityType="ServicePoint" EntityID="73825602" RequestSource="Scheduled" />
        </ContiguousIntervalSet>
      </ContiguousIntervalSets>
    </Channel>
	<Channel StartDate="2017-03-21T00:00:00-05:00" EndDate="2017-03-22T00:00:00-05:00" TimeZone="CentralUS" IsRegister="false" MarketType="Electric" IntervalLength="5" NumberOfDials="-1" PulseMultiplier="0.025" PressureCompensationFactor="1" IsReadingDecoded="true" ReadingsInPulse="false">
      <ChannelID ServicePointChannelID="76058806:404" />
      <ContiguousIntervalSets>
        <ContiguousIntervalSet NumberOfReadings="288">
          <TimePeriod StartTime="2017-03-21T00:00:00-05:00" EndTime="2017-03-22T00:00:00-05:00" />
          <Readings>
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
            <Reading Value="0.0" StatusRef="3" />
          </Readings>
          <ExportRequest RequestID="702" EntityType="ServicePoint" EntityID="76058806" RequestSource="Scheduled" />
        </ContiguousIntervalSet>
      </ContiguousIntervalSets>
    </Channel>
</Channels>
</MeterReadingDocument>
Here is my py code:
import xml.etree.ElementTree as ET
import csv

tree = ET.parse('dataexport.xml')
root = tree.getroot()[3]

with open('dataexport.csv', 'wb') as fout:
    writer = csv.writer(fout)
    row = ['Value', 'EntityId', 'ServicePointChannelID']
    writer.writerow(row)
    for channel in tree.iter('Channel'):
        for exportrequest in channel.iter('ExportRequest'):
            entityid = exportrequest.attrib.get('EntityID')
        for channelid in channel.iter ('ChannelID'):
            servicepointchannelid = channelid.attrib.get ('ServicePointChannelID')
            for meterread in channel.iter('Reading'):
                read = meterread.attrib.get('Value')
                row = [read, entityid, servicepointchannelid[9:]]
                print ', '.join(row)
                writer.writerow(row)
I am vexed.  Any help would be appreciated!
ASKER CERTIFIED SOLUTION
pepr

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros