0

Suppose I have a file named "file.txt".

  1. First I would like to open the file.txt file and delete all paragraphs from the file,
  2. Then I would like to delete all spaces in the file (which also include tabs),
  3. Finally, I would like to save the file file.txt with the previous changes.

Example of desired input:

Text1 Text2 Text3
Text4 Text5 Text5

Example of expected output:

Text1Text2Text3Text4Text5Text6

How could I do this with Python?

Emerson P L
  • 141
  • 6
  • 1
    can you show us what you have done so far ? a combination of [remove white space from string](https://stackoverflow.com/questions/8270092/remove-all-whitespace-in-a-string) and [open a file as a string](https://stackoverflow.com/questions/8369219/how-to-read-a-text-file-into-a-string-variable-and-strip-newlines) will probably work for you – Nijeesh Joshy Jul 22 '20 at 11:43
  • Thanks you all, best regards – Emerson P L Jul 22 '20 at 11:45

0 Answers0