i want to set a variable to represent the last line of a text file
how do i do that?
or even better, how do i create a list of the lines of a text file?
Jump to Post
Use readlines() to get a list of lines ...
# read a text file as a list of lines # find the last line, change to a file you have fileHandle = open ( 'test3.txt',"r" ) lineList = fileHandle.readlines() fileHandle.close() print lineList print "The last line is:" …
All 9 Replies
Be a part of the DaniWeb community
We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.