title: Send email based on print output - Python
body: <p>I have written a script with will check .docx file format in a particular format and give me the output on print function. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>import glob
  
  if glob.glob('//gbhfrd01/directorates/Business Support/Test/john//Python/*.docx'):
      print("File exist")
  else:
      print("File not exist")</code></pre>
  </div>
  </div>
  </p>
  
  <p>I want to send email based on the output of the print funtion. For example if "File not Exist" send email to abc@test.com. </p>
  
  <p>I have seen online how to send email with python but i don't know how can i send email based on the out put of my print function. </p>
  
  <p>Any help on this would be really greatful.</p>