Skip to content

Instantly share code, notes, and snippets.

@ItsIgnacioPortal
Created May 3, 2024 08:07
Show Gist options
  • Save ItsIgnacioPortal/b5c02a1077543c378325c4e3c482ff50 to your computer and use it in GitHub Desktop.
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.
# 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