title: Removing newline \n from tesseract return values
body: <p>I have a bunch of image each one corresponding to a name that I'm passing to Pytesseract for recognition. Some of the names are a bit long and needed to be written in multiple lines so passing them for recognition and saving them to a .txt file resulted in each part being written in a newline.</p>
  <p>Here's an example</p>
  <p><a href="https://i.stack.imgur.com/bs0dK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bs0dK.png" alt="enter image description here" /></a></p>
  <p>This is being recognized as</p>
  <pre><code>MARTHE
  MVUMBI
  </code></pre>
  <p>While I need them to be one the same line.</p>
  <p>Another Example</p>
  <p><a href="https://i.stack.imgur.com/j7RS6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/j7RS6.png" alt="enter image description here" /></a></p>
  <p>It should be <strong>MOHAMED ASSAD YVES</strong> but it's actually being stored as:</p>
  <p><strong>MOHAMED</strong></p>
  <p><strong>ASSAD YVES</strong></p>
  <p>I thought I was filtering through this sort of thing but apparently it's not working. Here's the code for recognition, storing and filtering that I'm using.</p>
  <pre><code># Adding custom options
  folder = rf&quot;C:\Users\lenovo\PycharmProjects\SoftOCR_PFE\name_results&quot;
  custom_config = r'--oem 3 --psm 6'
  words = []
  filenames = os.listdir(folder)
  filenames.sort()
  for directory in filenames:
      print(directory)
      for img in glob.glob(rf&quot;name_results\{directory}\*.png&quot;):
          text = pytesseract.image_to_string(img, config=custom_config)
          words.append(text)
      words.append(&quot;\n&quot;)
  all_caps = list([s.strip() for s in words if s == s.upper() and s != 'NOM' and s != 'PRENOM'])
  
  no_blank = list([string for string in all_caps if string != &quot;&quot;])
  
  with open('temp.txt', 'w+') as filehandle:
      for listitem in no_blank:
          filehandle.write(f'{listitem}\n')
  uncleanText = open(&quot;temp.txt&quot;).read()
  cleanText = re.sub('[^A-Za-z0-9\s\d]+', '', uncleanText)
  open('saved_names.txt', 'w').write(cleanText)
  </code></pre>
  <p>I had to post again since my last question was posted really late at night and didn't get any action.</p>