Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Check the line numbers of a file
# 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
You can’t perform that action at this time.