Answer the question
In order to leave comments, you need to log in
Text analysis in Python?
Hello! It is necessary to write a program that will look for the end of sentences in a text file and display each of them (the sentence) on a new line, are there any interesting suggestions on how to implement this? With the help of some libraries or something else...
Answer the question
In order to leave comments, you need to log in
Very easy
Learn python
Learn loops and built-in functions - you'll have enough of them
I usually do such things in a text editor through "Find and Replace", sentences should end with a dot (or a dot with a space), and so, I find the dots and change them to a dot with the end of the line character "\n". But if it's important for you through the script, then the first thing that comes to mind is to open the file using the "open" function and the "readline" method (in one line), using the "split" method to split this line into a list of lines (separator dot or dot with a space), then run this list through a loop removing unnecessary spaces and adding the end-of-line character "\n" to the end of the line and creating a new list of lines ("append" method), and then write this new list line by line to a new text file ( or display). As you can see, using a text editor is much easier. ))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question