djfz-2020-s444507/TaskA01/run.py

19 lines
274 B
Python
Raw Normal View History

2020-11-03 13:52:41 +01:00
import sys
def is_hamlet_in_line(line):
if 'Hamlet' in line:
return True
else:
return False
file1 = open("shakespeare.res", "a")
for line in sys.stdin:
if is_hamlet_in_line(line):
file1.write(line)
print(line.rstrip('\n'))