How to convert multiline string to single line string

My file contains data in multiple line with some space. I want to convert this file data into single line string
how can i do this?

Hi Shubham,

Kindly confirm is it text file or other file.

I am extracting pan card using OCR and storing result into outfield variable.
As when I write this field into text file,it stores into multiple line

Because I am new to this domain, please disregard any errors in my response.
Python, I assume, was the domain you were referring to. In fact, I was looking for a solution to this topic as well and found numerous in other forums. In stack-overflow, I discovered the following information, along with a practical example. You are welcome to refer to it, and I hope you find it useful. If not kindly avoid it.