Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f = open("satellites.xml", "r")
- lines = []
- lines = f.readlines()
- f.close()
- for idx,line in enumerate(lines):
- line = line.replace("\t", "")
- line = line.replace("\r", "")
- if "transponder" in line:
- line = line[13:-3]
- s = line.split(" ")
- o = {}
- for l in s:
- a = l.split("=")
- o[a[0]] = a[1]
- print '\t\t<transponder fec_inner=' + o['fec_inner'] + ' frequency=' + o['frequency'] + ' modulation=' + o['modulation'] + ' polarization=' + o['polarization'] +
- elif "sat " in line:
- line = line[5:-3]
- s = [line[0:line.index('"', 6)+1]]
- end = line[line.index('"', 6)+2:] + '"'
- s.extend(end.split(" "))
- o = {}
- for l in s:
- a = l.split("=")
- o[a[0]] = a[1]
- print '\t<sat flags=' + o['flags'] + ' name=' + o['name'] + ' position=' + o['position'] + '>'
- else:
- if idx in [0,1]:
- print line.replace("\n", "")
- else:
- print "\t" + line.replace("\n", "")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement