#!/usr/bin/env python def sextodec(num): first, second = num.split(':') first = float(first) second = float(second) return str(first + (second / 60)) def ratodec(num): first, second = num.split(':') first = float(first) # hours second = float(second) # minutes first += (second / 60) return str((first * 15) - 180) print '' print '' print '' print '' print ' Lynds Catalogue of Bright Nebulae' f = open('LBN.txt') for i, line in enumerate(f): if i == 0: continue line = line.rstrip('\r\n') number, ra, dec = line.split(' ') dec = sextodec(dec) ra = ratodec(ra) print ' ' print ' LBN %s' % number print ' ' print ' %s,%s' % (ra, dec) print ' ' print ' ' f.close() print '' print '' print ''