I have a problem with write()
in python, here is my code:
b=open("/home/thanasis/Dropbox/NoA/CasJobs/statistics_CI/filters.txt",'r')
a=open("/home/thanasis/Dropbox/NoA/CasJobs/statistics_CI/queries_CI.txt",'w')
for line in b:
temp=line
detector,filters=temp.split(",")
a.write("SELECT MATCHID,AVG(CI) AS CI_AV into mydb.CI_%s_%s" %(detector,filters))
a.write("from detailedcatalog \n where Detector = '%s' and Filter= '%s'" %(detector,filters))
a.write("GROUP BY MATCHID\ngo\n")
a.close()
and the output is the following:
SELECT MATCHID,AVG(CI) AS CI_AV into mydb.CI_ACS/WFC_F625W
from detailedcatalog
where Detector = 'ACS/WFC' and Filter= 'F625W
'GROUP BY MATCHID
go
The problem is that the '
character jumps to the next line. I've tried all kind of different ways to write it. Any suggestions?