#!/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.

sampleData = ["Harry", "Colorado", "Shenanigans", "Mandy", "Rusty"]

try:
    outFile = open("testdatawrite.txt",'w')

    for dog in sampleData:
        print(dog)
        outFile.writelines(dog+"\n")

except:
    print("File write error!")
    exit(-1)

# When I get to the end of the file.
#finally:
outFile.close()
