#!/usr/bin/python3
# ===================================================================
# Process star catalog data file - use Python slice strings
# ===================================================================
bcount = 0
lcount = 0
i = 0
inFile = open('bsc5.dat','r')
for line in inFile:
if i > 10: # only process the first 11 lines for testing
break
i += 1
### ---- strip leading and trailing whitespace
##line = line.strip()
# ---- remove trailing '\r\n' characters
line = line.rstrip('\r\n')
# ---- print the first 60 characters in a line
# ---- print the first field in the line (see catalog description)
print(line[0:60])
print(f'Bright Star Number ({line[0:4]})')
##print(f'line type={type(line)} len={len(line)}')
if not line: # blank line?
bcouunt += 1
lcount += 1 # count lines
inFile.close()
print(f'{lcount} lines in the file')
print(f'{bcount} blank lines in the file')