Why are the values of print len() different for both functions? Are they not the same?
The file this script is opening was a text file with three lines of text. i named it test.txt and inside it was
Jack and Jill
gave up
they went home with no water
Code:
def function2nd (filename):target = open(theFile, 'r')inData = target.read()print inDataprint len(inData)target.close()
theFile = raw_input("What is the file name?\n>>")
function2nd(theFile)def function3rd (filename):target = open(theFile, 'r')target.read()print target.read()print len(target.read())target.close()function3rd(theFile)