title: How to save String Template as a Text file in Python 3?
body: <p>I am taking data from .csv file and user to create a string template,Now I want to save this template as a text file.I have assigned the whole template into a single variable as </p>
  
  <pre><code>Temp=A, t.substitute(values))
  </code></pre>
  
  <p>but I am getting error.</p>
  
  <pre><code>def Mail_Temp():
  
      NSTT=input("Enter Case Number Number :")
      ActDate=input("Enter Activity Schedule date and time:")
      ProD=input("Enter Problem Description")
  
      A=  """
      ----------------------------------------------------------------------------------------
                      Basic Details Required for Logging Complaints
      ----------------------------------------------------------------------------------------
                          END CLIENT --Internate Network
      ```````````````````````````````````````````````````````````````````````````````````````` """
      values={'Dev':HostN, 'Add': Add,'Con':Contact,'Mail':Mail_ID,'SN':SN,'Ven':Ven,'NSTT':NSTT,'ActDate':ActDate,'ProD':ProD}
  
      #values = {'var': 'HOSTNMAE'}
  
      t = string.Template("""
      DEVICE HOSTNAME    : $Dev
      CONTACT Person Name: $Con
      EMAIL              : $Mail
      NSTT               : $NSTT
      Device SN          : $SN
      Vendor             : $Ven
      ADDRESS            : $Add
      Problem Description: $ProD
      Note               : Engineer must carry laptop ,console cable &amp; data card
      Activity Schedule  : $ActDate
      """)
  
      print(A, t.substitute(values))
  
  
      Temp = (A, t.substitute(values))
      f= open("Text.txt","w+")
      f.write(Temp)
      f.close()
  
  
  HostN, Add, Ven, SN, Contact, Mail_ID = get_Data()
  Mail_Temp()
  </code></pre>
  
  <p>Error::</p>
  
  <pre><code>File "C:\Users\xxxx\Desktop\xxxx\xxxxx\final data read and select.py", line 59, in Mail_Temp
      f.write(Temp)
  TypeError: write() argument must be str, not tuple
  </code></pre>
  
  <p>How I can import this template to Text file ...</p>