Alexandre B A Villares 🐍 on Nostr: Seems OK to me... #Python with open(text_file) as f: items = [line for line in ...
Seems OK to me... #Python
with open(text_file) as f:
items = [line for line in f.read().splitlines()
if line.strip() and not line.startswith('#')]
Context: A txt file with a list of files to process, some are commented out, and there is a first line head comment followed by a blank line.
with open(text_file) as f:
items = [line for line in f.read().splitlines()
if line.strip() and not line.startswith('#')]
Context: A txt file with a list of files to process, some are commented out, and there is a first line head comment followed by a blank line.