Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/362.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 为什么在很多CGI脚本中需要一个空的echo/print行?_Python_Bash - Fatal编程技术网

Python 为什么在很多CGI脚本中需要一个空的echo/print行?

Python 为什么在很多CGI脚本中需要一个空的echo/print行?,python,bash,Python,Bash,为什么在很多CGI脚本中需要一个空的echo/print行 bash示例: #!/bin/bash echo "Content-type: text/html" echo '' echo 'CGI Bash Example' python示例: #!/usr/bin/env python # -*- coding: UTF-8 -*- # enable debugging import cgitb cgitb.enable() print "Content-Type: text/plain

为什么在很多CGI脚本中需要一个空的echo/print行

bash示例:

#!/bin/bash
echo "Content-type: text/html"
echo ''
echo 'CGI Bash Example'
python示例:

#!/usr/bin/env python
# -*- coding: UTF-8 -*-

# enable debugging
import cgitb
cgitb.enable()

print "Content-Type: text/plain;charset=utf-8"
print  

print "Hello World!"

我不认为您的具体示例没有描述
echo''
的使用(如果有)。当我在中删除该行时,会出现500内部服务器错误。我使用Apache。请参阅本页标题为“通用格式”的部分