chr()compile(),copyright()credits()delattr()2018-10-5

chr()compile(),copyright()credits()delattr()2018-10-5.md

'内置函数代码:'

def chr(*args, **kwargs): # real signature unknown
    """ Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff. """
    pass

def compile(*args, **kwargs): # real signature unknown
    """
    Compile source into a code object that can be executed by exec() or eval().
    
    The source code may represent a Python module, statement or expression.
    The filename will be used for run-time error messages.
    The mode must be 'exec' to compile a module, 'single' to compile a
    single (interactive) statement, or 'eval' to compile an expression.
    The flags argument, if present, controls which future statements influence
    the compilation of the code.
    The dont_inherit argument, if true, stops the compilation inheriting
    the effects of any future statements in effect in the code calling
    compile; if absent or false these statements do influence the compilation,
    in addition to any features explicitly specified.
    """
    pass

def copyright(*args, **kwargs): # real signature unknown
    """
    interactive prompt objects for printing the license text, a list of
        contributors and the copyright notice.
    """
    pass

def credits(*args, **kwargs): # real signature unknown
    """
    interactive prompt objects for printing the license text, a list of
        contributors and the copyright notice.
    """
    pass

def delattr(x, y): # real signature unknown; restored from __doc__
    """
    Deletes the named attribute from the given object.
    
    delattr(x, 'y') is equivalent to ``del x.y''
    """
    pass


‘’‘
百度翻译:
DEF CHR(*ARGs,**KWARGS):未知实签名

“”用序号i返回一个字符的Unicode字符串;0 <=i <=0x10FFFF。

通过



DEF编译(*ARGs,**KARGGS):未知实签名

“”

将源编译为可以由Excel()或EVAL()执行的代码对象。



源代码可以表示Python模块、语句或表达式。

文件名将用于运行时错误消息。

模式必须是“执行”来编译一个模块,“单”编译一个

单(交互)语句,或“EVAL”编译表达式。

标志参数(如果存在的话)控制未来语句的影响。

汇编代码。

DONTHYNITION参数,如果为真,则停止编译继承。

在代码调用中任何将来陈述的效果

编译;如果没有或错误,这些语句会影响编译,

除了显式指定的任何特征外。

“”

通过



DEF版权(*ARGs,**KWARGS):未知的真实签名

“”

用于打印许可文本的交互式提示符对象,列表

撰稿人和版权声明。

“”

通过



DEF学分(*ARGs,**KARGGS):未知实签名

“”

用于打印许可文本的交互式提示符对象,列表

撰稿人和版权声明。

“”

通过



DEF DelTAFR(x,y):未知实签名;从

“”

从给定的对象中删除命名属性。



DelaTrac(x,y)相当于'del x.y′

“”

通过
’‘’
目录(无链接)
1 ordinal 有顺序的
2 character 字符
3 executed  执行
4 module,statement,expression 模块  声明  表达式
5 run-time error messages 
6 mode module 方式   模块
7 influence 影响
8 compilation 编绎
9 dont_inherit,inheriting , 非继承  继承
10 absent  缺席
11 explicitly specified  明确的规定
12 interactive prompt objects 交互提示对象
13 license 许可
14 contributors  贡献者
15 the named attribute 命名属性
16 is equivalent to 等同于

1 ordinal
[ 英 ['ɔːdɪn(ə)l] 美 ['ɔrdənl]
adj. 顺序的,依次的
n. [数] 序数]
{denoting(denote /dɪˈnəʊt/指示)
a certain(/'sɜːtn ;ˋsɝtṇ /,adj必须的,pron某些某几个)
position(/pə'zɪʃ ə n ;pəˋzɪʃən / , 位置,方位)
in a sequence(/'siːkwəns ;ˋsikwəns /,序列顺序)
of numbers 一系列的}
<Return a Unicode string of one character with ordinal i 百度:用序号i返回一个字符的Unicode字符串
个人理解:返回一个Unicode字符串排序为i的字符>

2 character
[ 英 ['kærəktə] 美 ['kærɪktɚ]
n. 性格,品质;特性;角色;[计] 字符
vt. 印,刻;使具有特征
n. (Character)人名;(英)克拉克特]
{the particular combination(结合) of qualities
(品质)that makes someone a particular(独特的)
type of person}
<字符>

3 executed <=> execute
[ 英 ['eksɪ,kjʊtɪd] 美 ['ɛksɪ,kjʊtɪd]
v. 履行(execute的过去分词)
adj. 已执行的;已生效的]
{To execute someone means to kill them as a
punishment(惩罚) for a serious
crime(罪行,犯罪). 处死}
<执行,履行,已执行的>

4 module(模块),statement(声明,陈述),expression
[]
{}
<>

	statement
		     [
				 英  ['steɪtm(ə)nt]   美  ['stetmənt]
				n. 声明;陈述,叙述;报表,清单
				]
		     {something you say or write, especially
		      publicly or officially, to let people 
		      know your intentions(意图) or
		       opinions(意见), or to record facts}
		     <声明,陈述>
		

	expression
			  [expression 
				 英  [ɪkˈspreʃn]   美  [ɪk'sprɛʃən]
				n. 表现,表示,表达;表情,脸色,态度,腔调,声调;式,符号;词句,语句,措辞,说法]
			  {something you say, write, or do that
			   shows what you think or feel
				〔用口头、书面或行动的〕表达,表示,表露}
			  <statement or expression :
			  语句或者表达式>

5 run-time error messages
[字面意思:运行时间,错误的信息]
<The filename will be used for run-time error messages,??>

	run-time
		   [rʌntaim] 
			n. [计] 运行时间;运转时间
		   {Run time is the time 
		   	during(在……的时候|期间) which a computer 
		   	program is running. (计算机) 运行时间}
		   <运行时间>

6 mode
[ 英 [məʊd] 美 [mod]
n. 模式;方式;风格;时尚
n. (Mode)人名;(德、英、法、乍、瑞典)莫德]
{a particular way or style of behaving, living
or doing something formal 方式,方法,做法}
<方式>

7 influence
[influence
英 ['ɪnflʊəns] 美 ['ɪnfluəns]
n. 影响;势力;感化;有影响的人或事
vt. 影响;改变]
{the power to affect the way someone or
something develops, behaves, or thinks,
without using direct force or orders
影响(力),作用}
<影响>

8 compilation
[ 英 [kɒmpɪ'leɪʃ(ə)n] 美 [,kɑmpɪ'leʃən]
n. 编译;编辑;汇编]
{a book, list, record etc which
consists(由……构成) of different pieces of
information, songs etc
辑,集,集子}
<the compilation of the code:代码编译 >

9 inherit
[ 英 [ɪn'herɪt] 美 [ɪn'hɛrɪt]
vt. 继承;遗传而得
vi. 成为继承人]
{to receive money, property(
财产,所有权,性质,性能) etc from someone
after they have died继承(遗产)}
<继承>

10 absent
[
英 [ˈæbsənt;(for v.)əbˈsent] 美 [ˈæbsnt;(for v.)əbˈsɛnt]
adj. 缺席的;缺少的;心不在焉的;茫然的
vt. 使缺席
]
{not at work, school, a meeting etc, because you
are sick or decide not to go缺席的,不在的}
<if absent or false如果缺少或者错误>

11.1 explicetly
[ 英 [ik'splisitli] 美 [ɪk'splɪsɪtli]
adv. 明确地;明白地]
{clearly,specifically, definitely,
particularly, positively}
<明确的>

11.2 specified
[ 英 [ˈspesɪfaɪd] 美 [spɛsəˌfaɪd]
adj. 规定的;详细说明的
v. 指定;详细说明(specify的过去分词)]
{If you specify(指定,详细说明,列举,把……列入说明书)
something, you give
information about what is required(必须的)
or should happen in a certain situation.
明确要求}
<in addition to any features explicitly specified.百度:除了显式指定的任何特征外。
理解:除了明确指定的任何特征外
in addition to除…之外
features特征( feature的名词复数 ); 特写; 面貌; 面貌的一部分
explicitly明白地,明确地
specified指定( specify的过去式和过去分词 ); 详述; 提出…>

12 prompt
[ 英 [prɒm(p)t] 美 [prɑmpt]
adj. 敏捷的,迅速的;立刻的
vt. 提示;促进;激起;(给演员)提白
n. 提示;付款期限;DOS命令:改变DOS系统提示符的风格
adv. 准时地]
{to make someone decide to do something
促使;激励}
<interactive prompt objects 交互式提示对象?>

13 license
[ 英 ['laɪsns] 美 ['laɪsns]
n. 执照,许可证;特许
vt. 许可;特许;发许可证给]
{to give official permission for someone to do or
produce something, or for an activity(活动) to
take place 批准,许可}
<许可>

14 attribute
[英 [(for n.) ˈatrɪbjuːt; (for v.)
əˈtrɪbjuːt] 美 [(for n.) ˈætrəˌbjut; (for
v.) əˈtrɪbjut]
n. 属性;特质
vt. 归属;把…归于]
{to believe or say that a situation(情况)
or event(事件) is caused by something
把…归因于…}
<属性>

15 is equivalent to :相近于

	equivalent
				[ 英  [ɪ'kwɪv(ə)l(ə)nt]   美  [ɪ'kwɪvələnt]
					adj. 等价的,相等的;同意义的
					n. 等价物,相等物]
				{having the same value, purpose, job
				 etc as a person or thing of a 
				 different kind
					等同的;等值的;相当的}
				<equivalent--->equal to等于=>

chr(int) chr:character mysql里char:character
int 是Unicode的编码顺序。返回unicode编码顺序值对应的字符

>>> for i in range(65,90):
...     chr(i)
... 
'A'
'B'
'C'
'D'
'E'
'F'
'G'
'H'
'I'
'J'
'K'
'L'
'M'
'N'
'O'
'P'
'Q'
'R'
'S'
'T'
'U'
'V'
'W'
'X'
'Y'
>>> 

函数compile()感觉没什么用,还不如直接用eval(input()) , exec(input())

'''
这个函数平时用得少,以下为摘抄菜鸟教程:http://www.runoob.com/python/python-func-compile.html

描述
compile() 函数将一个字符串编译为字节代码。

语法

以下是 compile() 方法的语法:

compile(source, filename, mode[, flags[, dont_inherit]])
参数

source -- 字符串或者AST(Abstract Syntax Trees)对象。。
filename -- 代码文件名称,如果不是从文件读取代码则传递一些可辨认的值。
mode -- 指定编译代码的种类。可以指定为 exec, eval, single。
flags -- 变量作用域,局部命名空间,如果被提供,可以是任何映射对象。。
flags和dont_inherit是用来控制编译源码时的标志
返回值
返回表达式执行结果。

>>>str = "for i in range(0,10): print(i)" 
>>> c = compile(str,'','exec')   # 编译为字节代码对象 
>>> c
<code object <module> at 0x10141e0b0, file "", line 1>
>>> exec(c)
0
1
2
3
4
5
6
7
8
9
>>> str = "3 * 4 + 5"
>>> a = compile(str,'','eval')
>>> eval(a)
17

'''

函数copyright(),查看python的版权!

>>> copyright()
Copyright (c) 2001-2018 Python Software Foundation.
All Rights Reserved.

Copyright (c) 2000 BeOpen.com.
All Rights Reserved.

Copyright (c) 1995-2001 Corporation for National Research Initiatives.
All Rights Reserved.

Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.
All Rights Reserved.
>>> 

函数credits(), 查看python英雄榜(贡献者们)!

>>> credits()
    Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
    for supporting Python development.  See www.python.org for more information.
>>> 

函数delattr(class_name,named_attribute),删除类名下的某个属性
还有haseattr(class_or_obj , attribute),
类或对象有attribute属性返回True,否则False
还有getattr(class_obj,attribute)(),加括号直接执行,

>>> class Dog:
>>>		name = 'Dogs'	

...     def print_dog(self):
...             print("dog")
... 
>>> d = Dog()
>>> d
<__main__.Dog object at 0x1019d9f98>
>>> d.print_dog
<bound method Dog.print_dog of <__main__.Dog object at 0x1019d9f98>>
>>> d.print_dog()
dog

>>> hasattr(d,'print_dog')
True
>>> getattr(d,'print_dog')()
dog

>>> delattr(d, 'print_dog')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: print_dog

>>> delattr(Dog,'print_dog')#Dog为类,d为Dog的实例


>>> d.print_dog()#已经删除了
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'Dog' object has no attribute 'print_dog'
>>> hasattr(d,'print_dog')
#delattr(class_name , named_attribute)
False
>>> 
posted @ 2018-10-05 13:58  Charles_Wu  阅读(133)  评论(0编辑  收藏  举报