Python readlines() returns empty string

  python, readfile

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?

Source: Python Questions

LEAVE A COMMENT