Skip to content

Instantly share code, notes, and snippets.

@markododa
Last active December 15, 2015 14:19
Show Gist options
  • Save markododa/5273205 to your computer and use it in GitHub Desktop.
Save markododa/5273205 to your computer and use it in GitHub Desktop.
simple file parser
#!/usr/bin/python
data = open('kanali.txt', 'r')
out = open('out.txt', 'w')
lines = data.readlines()
name = []
freq = []
#{Алфа} 303.25 0 {0} 0
for x in range(int(len(lines)/4)):
name.append(lines.pop(0).rstrip()), lines.pop(0)
freq.append(lines.pop(0).rstrip()), lines.pop(0)
for x in range(len(name)):
out.write('{'+name[x]+'} '+freq[x]+' 0 {0} 0\n')
data.close()
out.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment