Aug-24-2019, 09:38 PM
Thank you for the answer, actually it is a bit more complicated than I expected because there are more than 200 persons in the files and there is first and last name and more than one lines for everyone. I need to extract lines to separate file for every person of what he/she says and give to each file the corresponding name.
For example:
One of multiple input txt files
1.Rich Smith: I'm going to attend a concert on Saturday.
Do you have any special plans?
2.Peter Aderson : No, I'm going to relax. What did you do last weekend?
3.Rich Smith: Last weekend, I went to visit my friends in San Francisco. What did you do?
4.Peter Aderson: I played soccer with some friends.
5.Mary Sarah: Hello
6.John Daisa: hi
I need to have for output:
Rich.txt
Rich Smith: I'm going to attend a concert on Saturday
Rich Smith: Last weekend, I went to visit my friends in San Francisco. What did you do?
Peter.txt
Peter Aderson: No, I'm going to relax. What did you do last weekend?
Peter Aderson: I played soccer with some friends.
Mary.txt
Mary Sarah: Hello
John.txt
John Daisa: hi
I am thinking to have another file with the list of names and somehow to check it with the dialogue files but still it is complicated.
I am beginner in python, and this looks impossible to me.
For example:
One of multiple input txt files
1.Rich Smith: I'm going to attend a concert on Saturday.
Do you have any special plans?
2.Peter Aderson : No, I'm going to relax. What did you do last weekend?
3.Rich Smith: Last weekend, I went to visit my friends in San Francisco. What did you do?
4.Peter Aderson: I played soccer with some friends.
5.Mary Sarah: Hello
6.John Daisa: hi
I need to have for output:
Rich.txt
Rich Smith: I'm going to attend a concert on Saturday
Rich Smith: Last weekend, I went to visit my friends in San Francisco. What did you do?
Peter.txt
Peter Aderson: No, I'm going to relax. What did you do last weekend?
Peter Aderson: I played soccer with some friends.
Mary.txt
Mary Sarah: Hello
John.txt
John Daisa: hi
I am thinking to have another file with the list of names and somehow to check it with the dialogue files but still it is complicated.
I am beginner in python, and this looks impossible to me.