python中使用的关键字“license”是什么?

时间:2014-02-01 20:12:45

标签: python

我只是使用“许可证”作为变量名称,它突出显示,表示它是一个保留字,什么是“许可证”用于?

3 个答案:

答案 0 :(得分:7)

这不是关键字it's a constant added by the site module(其他一些是copyrightcredits)。如果您想知道它的作用,请尝试:

print license
>>> Type license() to see the full license text

然后输入

license()

输出将是:

  

甲。该软件的历史

     

Python是由Guido van Rossum在Stichting于20世纪90年代初创建的   在荷兰的数学中心(CWI,见http://www.cwi.nl)   作为ABC语言的继承者。 Guido仍然是Python的   主要作者,虽然它包括许多其他人的贡献。

     

1995年,Guido在公司继续他的Python工作   国家研究计划(CNRI,见http://www.cnri.reston.va.us)   在弗吉尼亚州雷斯顿,他在那里发布了几个版本   软件

     

2000年5月,Guido和Python核心开发团队搬到了   BeOpen.com组建BeOpen PythonLabs团队。十月也一样   一年,PythonLabs团队搬到了Digital Creations(现在是Zope   公司,见http://www.zope.com)。 2001年,Python软件   基金会(PSF,见http://www.python.org/psf/)成立了,a   专门为拥有Python相关而创建的非营利组织   知识产权。 Zope公司是赞助会员   PSF。

     

所有Python版本都是开源的(请参阅http://www.opensource.org for   点击返回更多,或q(和返回)退出:

答案 1 :(得分:3)

licensebuilt-in constants添加的site module之一。

它的使用完全在交互式解释器中:

>>> license
See http://www.python.org/2.7/license.html

其他此类对象包括creditscopyright,以及quit()exit()函数。

如果您对其实施感到好奇,请参阅setcopyright() function source

答案 2 :(得分:0)

这不是Python中的保留词:http://docs.python.org/2/reference/lexical_analysis.html#keywords

这是一个内置功能;尝试在交互式shell中运行它:

Python 2.7.3 (default, Sep 26 2013, 20:03:06)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> license
Type license() to see the full license text
>>> license()
A. HISTORY OF THE SOFTWARE
==========================

Python was created in the early 1990s by Guido van Rossum at Stichting
Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands
as a successor of a language called ABC.  Guido remains Python's
principal author, although it includes many contributions from others.

In 1995, Guido continued his work on Python at the Corporation for
National Research Initiatives (CNRI, see http://www.cnri.reston.va.us)
in Reston, Virginia where he released several versions of the
software.

In May 2000, Guido and the Python core development team moved to
BeOpen.com to form the BeOpen PythonLabs team.  In October of the same
year, the PythonLabs team moved to Digital Creations (now Zope
Corporation, see http://www.zope.com).  In 2001, the Python Software
Foundation (PSF, see http://www.python.org/psf/) was formed, a
non-profit organization created specifically to own Python-related
Intellectual Property.  Zope Corporation is a sponsoring member of
the PSF.

All Python releases are Open Source (see http://www.opensource.org for
Hit Return for more, or q (and Return) to quit: