如何在python脚本输出中停止'Content-type:text / html'?

时间:2018-04-30 14:33:33

标签: python

这是我的程序::我正在使用cgi-bin python

#!C:\ Program Files \ Python \ Python36 \ python.exe

print ("Content-type: text/html")
print("")
import cgi,cgitb
import pymysql
form = cgi.FieldStorage() 
cgitb.enable()
UUID = form.getvalue('uuid')
db = pymysql.connect(host="localhost",  user="root", passwd="", db="fullstack")# name of the data base       
cur = db.cursor()
def select_from_sql(uuid):
        #(self.cur).execute('''select (id, source_server,source_path,destination_path) values (%s, %s,%s,%s) from posts''', (self.id,self.source_server,self.source_path,self.destination_path) )
    cur.execute("SELECT * FROM posts WHERE id=%s",(uuid))
    row=cur.fetchall()
    for i in row:
        print("<br>")
        print("<b>Id:</b>"+i[0])
        print("<br>")
        print("<b>source_server:</b>"+i[1])
        print("<br>")
        print("<b>source_path:</b>"+i[2])
        print("<br>")
        print("<b>destination_path</b>"+i[3])
        print("<br>")
    #for row in rows:
      #     print ("id:",row["id"])
      #     print ("source_server:%s",row["source_server"])
      #     print ("source_path:%s",row["source_path"])
        #print("destination_path:%s",row["destination_path"])
select_from_sql(UUID)

那是我的代码:

output:
Content-type: text/html 
Id:39b5fa6b-1624-4cb7-aad3-38986dcb10b1 
source_server:www.google.com 
source_path:C:\xampp\htdocs\test 
destination_pathC:\Users\HA326887\login\login 

如何在输出中停止打印Content-type:text / html

0 个答案:

没有答案