Created
March 19, 2020 18:16
-
-
Save Croydon/7ff833b41e9ee48270147e3615510fe6 to your computer and use it in GitHub Desktop.
Find longest line in all Python files in CCI
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
import glob | |
import os | |
record = 0 | |
record_file = "" | |
for filename in glob.iglob(os.path.join(".", "recipes", "**"), recursive=True): | |
if os.path.isfile(filename) and filename.endswith(".py"): | |
print(filename) | |
current = len(max(open(filename), key=len)) | |
if current > record: | |
record = current | |
record_file = filename | |
print("Biggest line: {} in {}".format(str(record), record_file)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment