First, I would like to explain that since this is my first post, I did a lot of research before publishing my question, as is suggested in the Q&A of this excellent platform. The second point I make is that I am not a python expert. In fact, I'm just an enthusiast for this great programming language. Well, I'm trying to fix a relatively large txt file. The point of the question is the correction of the syllabic separations that exist in the referred file, and in great quantity. In my research, I found some articles similar to my question, which even helped me a lot to think in different perspectives. Among these articles, I can highlight some such as:
Using grep:
grep -v '^$' test1.txt > test2.txt
Using fileinput:
import fileinput for line in fileinput.FileInput("file",inplace=1): if line.rstrip(): print line
But, unfortunately my question is more specific. In my txt files there are many syllabic separations. Thank goodness, they are all standardized this way:
example_of_w'- '
ord
My goal would be, through some python script, all file separations to be corrected / eliminated, as an example below:
Before script:
example_of_w'- '
ord
After script:
example_of_word
Note that the syllabic separation is patterned with - and 'space'. Please excuse me if I was not able to be clear in my question, and with my language mistakes. I thank you all for any help. An excellent day for everyone!