help()hex()id()input()2018-10-9


def help():#real signature unknown; restored from __doc__
	'''
	Define the builtin 'help'.

		This is a wrapper【包装纸】 around pydoc【python document 文档】help that provides a helpful message when 'help' is typed【当'帮助'被键入时】 at the Python interactive prompt【prompt提示|dos命令,交互dos命令】.

		Calling help() at the Python prompt starts an interactive help session【会话,会议。在Python dos命令下调用help()帮助启动交互式帮助会话】.
		Calling help(thing) prints help for the python object 'thing'.
	'''
	pass
	'''帮助,可以带参数,也可以不带,当在交互模式下输入help()会弹出提示消息
		如果带参数,就是要查具体的帮助事项,如果__doc__里有这个帮助事项就会弹出帮助会话'''

baidu_translate='''

Define the builtin 'help'.

定义内置的“帮助”。



This is a wrapper around pydoc.help that provides a helpful message

这是一个围绕PyDOC.Wrp的包装,它提供了有用的信息。

when 'help' is typed at the Python interactive prompt.

当“帮助”在Python交互式提示符中键入时。



Calling help() at the Python prompt starts an interactive help session.

在Python提示符下调用帮助()会启动一个交互式帮助会话。

Calling help(thing) prints help for the python object 'thing'.

调用帮助(PATH)打印Python对象的“帮助”。

'''

>>> help()

Welcome to Python 3.7's help utility!

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at https://docs.python.org/3.7/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, symbols, or topics, type
"modules", "keywords", "symbols", or "topics".  Each module also comes
with a one-line summary of what it does; to list the modules whose name
or summary contain a given string such as "spam", type "modules spam".




help> q

You are now leaving help and returning to the Python interpreter.
If you want to ask for help on a particular object directly from the
interpreter, you can type "help(object)".  Executing "help('string')"
has the same effect as typing a particular string at the help> prompt.




>>> help('hello world')#没有就会提醒没有关于'hello world'的帮助,如果要看字符串的帮助输入:help('str')
No Python documentation found for 'hello world'.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.



>>> help('int')#要加上引号,查看int类

Help on class int in module builtins:

class int(object)
 |  int([x]) -> integer
 |  int(x, base=10) -> integer
 |  
 |  Convert a number or string to an integer, or return 0 if no arguments
 |  are given.  If x is a number, return x.__int__().  For floating point
 |  numbers, this truncates towards zero.
 |  
 |  If x is not a number or if base is given, then x must be a string,
 |  bytes, or bytearray instance representing an integer literal in the
 |  given base.  The literal can be preceded by '+' or '-' and be surrounded
 |  by whitespace.  The base defaults to 10.  Valid bases are 0 and 2-36.
 |  Base 0 means to interpret the base from the string as an integer literal.
 |  >>> int('0b100', base=0)
 |  4
 |  
 |  Methods defined here:
 |  
 |  __abs__(self, /)
 |      abs(self)
 |  
 |  __add__(self, value, /)
 |      Return self+value.
 |  
 |  __and__(self, value, /)
 |      Return self&value.
 |  
 |  __bool__(self, /)
 |      self != 0
 |  
 |  __ceil__(...)
 |      Ceiling of an Integral returns itself.
 |  
 |  __divmod__(self, value, /)
 |      Return divmod(self, value).
 |  
 |  __eq__(self, value, /)
 |      Return self==value.
 |  
 |  __float__(self, /)
 |      float(self)
 |  
 |  __floor__(...)
 |      Flooring an Integral returns itself.
 |  
 |  __floordiv__(self, value, /)
 |      Return self//value.
 |  
 |  __format__(self, format_spec, /)
 |      Default object formatter.
 |  
 |  __ge__(self, value, /)
 |      Return self>=value.
 |  
 |  __getattribute__(self, name, /)
 |      Return getattr(self, name).
 |  
 |  __getnewargs__(self, /)
 |  
 |  __gt__(self, value, /)
 |      Return self>value.
 |  
 |  __hash__(self, /)
 |      Return hash(self).
 |  
 |  __index__(self, /)
 |      Return self converted to an integer, if self is suitable for use as an index into a list.
 |  
 |  __int__(self, /)
 |      int(self)
 |  
 |  __invert__(self, /)
 |      ~self
 |  
 |  __le__(self, value, /)
		Return self<=value.
 |  
 |  __lshift__(self, value, /)
 |      Return self<<value.
 |  
 |  __lt__(self, value, /)
 |      Return self<value.
 |  
 |  __mod__(self, value, /)
 |      Return self%value.
 |  
 |  __mul__(self, value, /)
 |      Return self*value.
 |  
 |  __ne__(self, value, /)
 |      Return self!=value.
 |  
 |  __neg__(self, /)
 |      -self
 |  
 |  __or__(self, value, /)
 |      Return self|value.
 |  
 |  __pos__(self, /)
 |      +self
 |  
 |  __pow__(self, value, mod=None, /)
 |      Return pow(self, value, mod).
 |  
 |  __radd__(self, value, /)
 |      Return value+self.
 |  
 |  __rand__(self, value, /)
 |      Return value&self.
 |  
 |  __rdivmod__(self, value, /)
 |      Return divmod(value, self).
 |  
 |  __repr__(self, /)
 |      Return repr(self).
 |  
 |  __rfloordiv__(self, value, /)
 |      Return value//self.
 |  
 |  __rlshift__(self, value, /)
 |      Return value<<self.
 |  
 |  __rmod__(self, value, /)
 |      Return value%self.
 |  
 |  __rmul__(self, value, /)
 |      Return value*self.
 |  
 |  __ror__(self, value, /)
 |      Return value|self.
 |  
 |  __round__(...)
 |      Rounding an Integral returns itself.
 |      Rounding with an ndigits argument also returns an integer.
 |  
 |  __rpow__(self, value, mod=None, /)
 |      Return pow(value, self, mod).
 |  
 |  __rrshift__(self, value, /)
 |      Return value>>self.
 |  
 |  __rshift__(self, value, /)
 |      Return self>>value.
 |  
 |  __rsub__(self, value, /)
 |      Return value-self.
 |  
 |  __rtruediv__(self, value, /)
 |      Return value/self.
  __rxor__(self, value, /)
 |      Return value^self.
 |  
 |  __sizeof__(self, /)
 |      Returns size in memory, in bytes.
 |  
 |  __str__(self, /)
 |      Return str(self).
 |  
 |  __sub__(self, value, /)
 |      Return self-value.
 |  
 |  __truediv__(self, value, /)
 |      Return self/value.
 |  
 |  __trunc__(...)
 |      Truncating an Integral returns itself.
 |  
 |  __xor__(self, value, /)
 |      Return self^value.
 |  
 |  bit_length(self, /)
 |      Number of bits necessary to represent self in binary.
 |      
 |      >>> bin(37)
 |      '0b100101'
 |      >>> (37).bit_length()
 |      6
 |  
 |  conjugate(...)
 |      Returns self, the complex conjugate of any int.
 |  
 |  to_bytes(self, /, length, byteorder, *, signed=False)
 |      Return an array of bytes representing an integer.
 |      
 |      length
 |        Length of bytes object to use.  An OverflowError is raised if the
 |        integer is not representable with the given number of bytes.
   byteorder
 |        The byte order used to represent the integer.  If byteorder is 'big',
 |        the most significant byte is at the beginning of the byte array.  If
 |        byteorder is 'little', the most significant byte is at the end of the
 |        byte array.  To request the native byte order of the host system, use
 |        `sys.byteorder' as the byte order value.
 |      signed
 |        Determines whether two's complement is used to represent the integer.
 |        If signed is False and a negative integer is given, an OverflowError
 |        is raised.
 |  
 |  ----------------------------------------------------------------------
 |  Class methods defined here:
 |  
 |  from_bytes(bytes, byteorder, *, signed=False) from builtins.type
 |      Return the integer represented by the given array of bytes.
 |      
 |      bytes
 |        Holds the array of bytes to convert.  The argument must either
 |        support the buffer protocol or be an iterable object producing bytes.
 |        Bytes and bytearray are examples of built-in objects that support the
 |        buffer protocol.
 |      byteorder
 |        The byte order used to represent the integer.  If byteorder is 'big',
 |        the most significant byte is at the beginning of the byte array.  If
 |        byteorder is 'little', the most significant byte is at the end of the
 |        byte array.  To request the native byte order of the host system, use
 |        `sys.byteorder' as the byte order value.
 |      signed
 |        Indicates whether two's complement is used to represent the integer.
 |  
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |  
 |  __new__(*args, **kwargs) from builtins.type
 |      Create and return a new object.  See help(type) for accurate signature.
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |  
 |  denominator
 |      the denominator of a rational number in lowest terms
 |  
 |  imag
 |      the imaginary part of a complex number
 |  
 |  numerator
 |      the numerator of a rational number in lowest terms
 |  
 |  real
 |      the real part of a complex number
(END)




def hex(*args , **kwargs):#real signature unknow【未知的真实签名??】;NOTE:unreliably restored from __doc__(不可依赖地存储在文档中???)
	'''
	Return the hexadecimal【美  [,hɛksə'dɛsɪml十六进制的】 representation【十六进制的表现形式】 of an integer.

	>>> hex(12648430)
	'OxcOffee'
	'''
	pass
	'''将10进制的整数转成16进制'''

baidu_translate = '''
Return the hexadecimal representation of an integer.

返回一个整数的十六进制表示。

'''

>>> hex(12648430)
'0xc0ffee'
>>> hex(10.8)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'float' object cannot be interpreted as an integer
>>> hex(15)
'0xf'
>>> hex(8)
'0x8'
>>> 



def id(*args , **kwargs):#real signature unknown
	'''
	Return the identity【美  [aɪ'dɛntəti]身份。】of an object.

	This is guaranteed to be unique among simultaneously【 美  [saɪməl'tenɪəsli]同时地】existing objects.
	(CPython uses the object's memory address.)
	'''
	pass
	'''在CPython中,id()用于查看某个对象在内存中的地址,python一切皆对象,builtins开篇就注释:None is the 'nil' object'''
baidu_translate='''

Return the identity of an object.

返回对象的标识。



This is guaranteed to be unique among simultaneously existing objects.

这保证在同时存在的对象中是唯一的。

(CPython uses the object's memory address.)

(cPython使用对象的内存地址。)

'''

>>> id(help)
4329058488
>>> id(type)
4297476640
>>> id(int)
4297450304
>>> id(str)
4297488448
>>> id(list)
4297448128
>>> id(dict)
4297451968
>>> id(set)
4297470464
>>> id(tuple)
4297475424
>>> a = 'hello world'
>>> id(a)
4301803568
>>> 


def input(*args , *kwargs):#real signature unknow
	'''
	Read a string from standard input.  The trailing【拖尾的,尾部的】 newline is stripped【剥去的】.

	The prompt string ,if given , is printed to standard output without a trailing newline before reading input.

	if the user hits EOF(*nix:Ctrl-D,Windows:Ctrl-Z+Return),raise EOFFrror.
	On *nix systems ,readline is used if available.
	'''
	pass
	'''说白了,就是给用户提供一个输入的接口,input()括号里可以写入字符串作为提示信息,返回的是用户输入内容的字符串'''

baidu_translate = '''
Read a string from standard input. The trailing newline is stripped.

从标准输入读取字符串。尾线被剥离。



The prompt string, if given, is printed to standard output without a

提示字符串,如果给定,则打印到没有标准的标准输出。

trailing newline before reading input.

在读取输入之前跟踪新行。



If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.

如果用户点击EOF(*NIX:CTRL D,Windows:CTRL Z+返回),提高EOFError。

On *nix systems, readline is used if available.

在*NIX系统中,如果可用,则使用Read Load。

'''


>>> input()#空时可以
hello word
'hello word'
>>> input(5)#数字也可以
55555
'5555'
>>> input('请输入你的名字')#这种很常用
请输入你的名字river
'river'

>>> input([i for i in range(3)], '两个值也可以:》》》')#报错了,说明只能一个参数
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: input expected at most 1 arguments, got 2

>>> input([i for i in range(3)])#input没限定参数
[0, 1, 2]列表,字典,集合,元组都可以
'列表,字典,集合,元组都可以'
>>> 


#看到百度翻译的结果就知道(牛头不对马嘴),学python要看懂源码,要看懂官方英文文档不是记几个英文单词就可以的。


posted @ 2018-10-09 10:32  Charles_Wu  阅读(207)  评论(0编辑  收藏  举报