Separate text files containing sentences by period with Python

Asked 2 years ago, Updated 2 years ago, 13 views

If the following sentences are entered in the file ss.txt,

First sentence. [Voiceover] The second sentence. [Voiceover] The third sentence.

There are sentences and sentences attached now, but I'd like to divide them based on [period + space] so that only one sentence comes in a line. (For example, I simplified the sentence, because the actual data has decimal points, so it also includes decimal points based on periods only)

First sentence.
This is the second sentence.
[Voiceover] The third sentence.

I want to make it like this and save it as a file.

python

2022-09-22 08:57

1 Answers

'.\n'.join (string.split(". "))


2022-09-22 08:57

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.