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
Temp=A, t.substitute(values))
but I am getting error.
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 & 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()
Error::
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
How I can import this template to Text file ...