how to read a file into array in python

Solutions on MaxInterview for how to read a file into array in python by the best coders in the world

showing results for - "how to read a file into array in python"
Agustina
05 Feb 2017
1def readFile(fileName):
2        fileObj = open(fileName, "r") #opens the file in read mode
3        words = fileObj.read().splitlines() #puts the file into an array
4        fileObj.close()
5        return words