#!/usr/bin/python3

# See https://stackabuse.com/read-a-file-line-by-line-in-python/
# for more information
# Just try reading it line by line on the first attempt.

fileName = "testxdata.txt"
try:
    inFile = open(fileName,'r')

    count = 1
    line = inFile.readline()
    line = line.rstrip("\n")
    while(line):  # Read line and place in variable named line
#        print(count,line.rstrip("\n"))
        print(count,line)
        line = inFile.readline()
        line = line.rstrip("\n")
        count = count + 1

except Exception as e:
    print("Some error occurred. Ending here",e)
    exit(-1)

inFile.close()
