Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to read a data file in python and build a list of files

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()
Source by www.chegg.com #
 
PREVIOUS NEXT
Tagged: #read #data #file #python #build #list #files
ADD COMMENT
Topic
Name
6+1 =