Hello everyone, I am trying to read a text file in Python and my goal is to read the lines in the file line-wise and remove spaces, newline characters, and all these characters from each line and store the processed and clean data into a tuple or a list. The only read function of files I know is read()
which reads all the contents of the file at once, if anyone can help me with this by giving some example codes, I would greatly appreciate it.
As an example, if I have a file such as:
this is line number one of the text file \n\t
this is line number two of the text file
I want to read each individual line and remove these spaces and newline or tab characters.