stations = [] src = open('/home/user/.mplayer/channels.conf.ter') for line in src.readlines(): (st, dummy) = line.split(':', 1) if not st in stations: stations.append(st) src.close() dest = open('dvb-t.m3u', 'w') dest.write('#EXTM3U\n') i = 1 for st in stations: dest.write('\n') dest.write('#EXINF:-1, %s\n' % st) dest.write('dvb://%s\n' % st)