Hey there.
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?
any suggestions?
ruwach
0
Newbie Poster
Recommended Answers
Jump to PostUse 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
vegaseat
1,735
DaniWeb's Hypocrite
Team Colleague
ruwach
0
Newbie Poster
danholding
5
Junior Poster in Training
TrustyTony
888
pyMod
Team Colleague
Featured Poster
danholding
commented:
very helpfull
+1
snippsat
661
Master Poster
danholding
commented:
very helpfull
+1
danholding
5
Junior Poster in Training
snippsat
661
Master Poster
danholding
5
Junior Poster in Training
gunjan_3
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.