Created
March 24, 2020 02:03
-
-
Save galtay/da921286147cf6d6f520ccccd14dd5d2 to your computer and use it in GitHub Desktop.
python count file lines
This file contains hidden or 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
def count_file_lines(file_path: str) -> int: | |
output = subprocess.check_output(["wc", "-l", file_path]) | |
num_lines = int(output.split()[0]) | |
return num_lines |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment