I ran the following code in Python:
def translateDesc(fileName):
textFile = open("fileName", "r")
fileLines = textFile.readlines()
return fileLines
And the function returns an empty string. However, when I ran the lines one by one in the iPython terminals, the function returned was not empty. How should I fix this issue?
filenamevariable:textFile = open(fileName, "r")readlinesdoesn't return strings. It returns a list of some number of strings.