Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Find length of text file Python

import sys
args: list[str] = sys.argv
filename = args[1]
file = open(filename, "r")
line_count = 0

for line in file:

    if line != "
":

        line_count += 1



print(line_count)
 
PREVIOUS NEXT
Tagged: #Find #length #text #file #Python
ADD COMMENT
Topic
Name
1+5 =