python输出姓名和成绩,如何从python获取成绩单中的演讲者姓名?

How to write a program which can identify that who is the speaker in a text and what is he telling then I have to print "Speaker Name" and "The speech" on the screen like below. And if someone(assume Ram) says something, and in his speech another one (assume Sam) says something then I have to add it in 2 lines like-

Ram |

Sam |

The " | " just for showing the different between string like-

Speaker | Speech

Please see the example below to properly understand.

I have text file like this below-

==== START OF THE TEXT FILE ====

Ram said that he was a good boy.

Sam also said "I am also a good boy like Ram".

Ram asked Sam that where he wanted to do?

Sam replied that he wanted to do some thing but Naren his fiend said him to go to school, so he could not do the work.

====== END OF THE TEXT FILE ======

I have to make it like this in another text file-

======== START OF THE TEXT FILE ======

"Ram" | "said" | "that he was a good boy."

"Sam" | "also said" | "I am also a good boy like Ram".

"Ram" | "asked" | "Sam that where he wanted to do?"

"Sam" | "replied" | "that he wanted to do some thing but Naren his fiend said him to go to school, so he could not do the work."

"Naren" | "said" | "him to go to school"

======= END OF THE TEXT FILE ======

解决方案Create simple if else then statements and create array from them.

That should be enough info to solve the school project

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值