from text file to python list code example
Example 1: how to put a text file into a list python
# name.txt
david
mary
john
with open('names.txt', 'r') as f:
myNames = [line.strip() for line in f]
# Result
['david','mary','john']
Example 2: convert text file into list
crimefile = open(fileName, 'r')
yourResult = [line.split(',') for line in crimefile.readlines()]