examples/files/colors.py
from __future__ import print_function

def main():
    try:
        with open('colors.txt', 'r') as fh:
            #colors = fh.readlines()
            #colors = [line.rstrip("\n") for line in fh.readlines()]
            colors = [line.rstrip("\n") for line in fh]
    except IOError:
        print("Could not open colors.txt")
        exit()
    
    for i in range(0, len(colors)):
        print("{}) {}".format(i, colors[i]))
    
    c = int(raw_input("Select color: "))
    print(colors[c])

main()