Skip to content

Instantly share code, notes, and snippets.

@galtay
Created March 24, 2020 02:03
Show Gist options
  • Save galtay/da921286147cf6d6f520ccccd14dd5d2 to your computer and use it in GitHub Desktop.
Save galtay/da921286147cf6d6f520ccccd14dd5d2 to your computer and use it in GitHub Desktop.
python count file lines
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