f = open("RandomNames.txt", "r") rowList = [] for line in f.readlines(): rowList.append(line[0:-1]) print(rowList) f.close() f = open("RandomNames.txt", "r") idList = [] for line in f.readlines(): temp = line.split(",") idList.append(int(temp[0])) print(idList) f.close()