Skip to content

Instantly share code, notes, and snippets.

@rebrec
Created November 24, 2014 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rebrec/273d9a46915aef686f9c to your computer and use it in GitHub Desktop.
Save rebrec/273d9a46915aef686f9c to your computer and use it in GitHub Desktop.
# -*- codding:utf-8 -*-
from xml.dom import minidom
import os.path
# The top argument for walk. The
# Python27/Lib/site-packages folder in my case
topdir="C:\\Users\\frlam\\Desktop\\Conf BIRDY WP"
# The arg argument for walk, and subsequently ext for step
exten = '.birdyW.xml'
def perteReseauFromFile(strFile):
#strFile = strFile.replace('\\','/') # not working either
res = []
doc = minidom.parse(strFile)
print strFile
inactive = doc.getElementsByTagName("networkLostTempo")
if inactive == []:
inactive = doc.getElementsByTagName("POCSAGSurvey")
res =inactive.firstChild.nodeValue
print res
return res
def step(ext, dirname, names):
ext = ext.lower()
for name in names:
if name.lower().endswith(ext):
f=os.path.join(dirname, name)
print(f)
print extractEpromDataFromFile(f)
# Start the walk
os.path.walk(topdir, step, exten)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment