jezyki-formalne/TaskA02/solution.py
2024-12-06 11:27:25 +01:00

15 lines
464 B
Python

# File path to read
file_path = 'text.txt'
# Open the file and search for lines containing the word "pies"
with open(file_path, 'r') as file:
lines_with_pies = []
for line in file:
# Split the line into words and check for the word "pies" (case-insensitive)
words = line.strip().lower().split()
if 'pies' in words:
lines_with_pies.append(line.strip())
# Display the results
for line in lines_with_pies:
print(line)