Last active
April 14, 2018 03:52
-
-
Save yanshengjia/9751c03f8600f1230c42504db88637b0 to your computer and use it in GitHub Desktop.
Check the line numbers of a file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# python2 | |
def check_line_numbers(): | |
file_path = 'test.txt' | |
num_lines = sum(1 for line in open(file_path)) | |
print(num_lines) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment