【发布时间】:2012-08-04 06:23:18
【问题描述】:
是否可以区分我的 Python 脚本是从 Web 服务器(作为 CGI 脚本)还是从命令行执行的?
我看到了一些只针对 PHP 和 Perl 的回复:
What is the canonical way to determine commandline vs. http execution of a PHP script?
How can I determine if a script was called from the command line or as a cgi script?
【问题讨论】: