CHILD: I saw giraffe swimming in the pool to get that ball. Hi everyone!Teacher: What is your name. what did you see?CHILD: My name is John.I am a boy. I go to school everyday.I have two brothers and sistersTeacher: I saw giraffe swimming in the pool to get that ball .我如何才能获得仅由 Child 讲述的台词?
1 回答
大话西游666
TA贡献1817条经验 获得超14个赞
with open("sample.txt", "r") as file:
for line in file.readlines():
if "CHILD:" in line:
speaker = 1
elif "Teacher:" in line:
speaker = 2
if speaker == 1:
print(line)
这样可行。接下来,尝试发布您的方法。
添加回答
举报
0/150
提交
取消