python 3 text file leng April 13, 2023 by wordlinkanswers python 3 text file leng Comment 10 f = open(“filename”, “r”) #Load file in any mode that’s able to read, ie r, r+, w+ etc</p> <p>#to get length<br /> len(f.readlines())</p> <p>#To iterate over each line<br /> for line in f.readlines(): #file.readlines(), splits the file into a list, where each element is a seperate line<br /> print(line) Popularity 9/10 Helpfulness 10/10 Language python Source: WorldLinkAnswers Tags: file python text Share Link to this answer Share Contributed on Mar 02 2020 Frightened Ferret 0 Answers Avg Quality 2/10 wordlinkanswers