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.

Reply to this note

Please Login to reply.

Discussion

nostr:npub1mjjwe95dghhw434k4vsvxs5yl6gcr6kupghf5u0dgcvhga0w94sqe7h2pr I'd say this isn't performant because it copies the string unnecessarily.