python 的函数学习经验

遇到函数使用上的疑问,可以先用help()来查询,例如在Python3中range()的用法,可返回的是一个可迭代的对象

>>> help(range)
Help on class range in module builtins:

class range(object)
 |  range(stop) -> range object
 |  range(start, stop[, step]) -> range object
 |
 |  Return an object that produces a sequence of integers from start (inclusive)
 |  to stop (exclusive) by step.  range(i, j) produces i, i+1, i+2, ..., j-1.
 |  start defaults to 0, and stop is omitted!  range(4) produces 0, 1, 2, 3.
 |  These are exactly the valid indices for a list of 4 elements.
 |  When step is given, it specifies the increment (or decrement).
 |
 |  Methods defined here:
 |
 |  __bool__(self, /)
 |      self != 0
 |
 |  __contains__(self, key, /)
 |      Return key in self.

。。

英语不好可以先借助有道翻译一下内容

了解了之后,如何还是不太明白,可在菜鸟Python中查内置函数 http://www.runoob.com/python3/python3-built-in-functions.html

 

 

posted @ 2018-04-17 10:20  Gringer  阅读(178)  评论(0)    收藏  举报