Advertisement
Guest User

Untitled

a guest
Apr 9th, 2020
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.02 KB | None | 0 0
  1. f = open("satellites.xml", "r")
  2. lines = []
  3. lines = f.readlines()
  4. f.close()
  5.  
  6. for idx,line in enumerate(lines):
  7.    line = line.replace("\t", "")
  8.    line = line.replace("\r", "")
  9.    if "transponder" in line:
  10.        line = line[13:-3]
  11.        s = line.split(" ")
  12.        o = {}
  13.        for l in s:
  14.             a = l.split("=")
  15.             o[a[0]] = a[1]
  16.        print '\t\t<transponder fec_inner=' + o['fec_inner'] + ' frequency=' + o['frequency'] + ' modulation=' + o['modulation'] + ' polarization=' + o['polarization'] +
  17.    elif "sat " in line:
  18.        line = line[5:-3]
  19.        s = [line[0:line.index('"', 6)+1]]
  20.        end = line[line.index('"', 6)+2:] + '"'
  21.        s.extend(end.split(" "))
  22.        o = {}
  23.        for l in s:
  24.            a = l.split("=")
  25.            o[a[0]] = a[1]
  26.        print '\t<sat flags=' + o['flags'] + ' name=' + o['name'] + ' position=' + o['position'] + '>'
  27.    else:
  28.         if idx in [0,1]:
  29.             print line.replace("\n", "")
  30.         else:
  31.             print "\t" + line.replace("\n", "")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement