#!/usr/bin/python3 # =================================================================== # Read star catalog data file - use Python slice strings # =================================================================== bcount = 0 lcount = 0 inFile = open('bsc5.dat','r') for line in inFile: # ---- remove trailing '\r\n' characters line = line.rstrip('\r\n') # ---- print the first 60 charactere of a line # ---- print the first field (see catalog description) ##print(line[0:60]) if not line: # blank line? bcouunt += 1 # blank line count lcount += 1 # line count inFile.close() print(f'{lcount} lines in file') print(f'{bcount} blank lines read') print()