Created
May 3, 2024 08:07
-
-
Save ItsIgnacioPortal/b5c02a1077543c378325c4e3c482ff50 to your computer and use it in GitHub Desktop.
Python script that prints all lines in a file which are at least X characters long.
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
# Open the text file | |
with open("/path/to/file", 'r') as file: | |
# Read each line in the file | |
for line in file: | |
# Check if the line has 8 or more characters | |
if len(line.strip()) >= 8: | |
# Print the line | |
print(line.strip()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment