The issue is with your statement print fread.flist
. You can't access variables assigned inside functions this way. Instead, change your fread()
function to the following:
def fread(file, *args):
flist = open(file).readlines()
return flist
and change the statement above to
print fread(file)
where file
is the file you want to access.