[Python 123] Number of file lines

description

Print out the effective number of lines in the attached file. Note: Blank lines are not counted as effective lines.

Input and output example

Insert picture description here

annex

See Appendix

Code

fo = open("latex.log")
row = 0
for line in fo:
    # line = line.replace(" ", "") 这里不需要替换空格字符
    

Guess you like

Origin blog.csdn.net/weixin_43012724/article/details/103654475