交互器中python中的帮助使用
C:\Users\ceshi>python
Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:24:40) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import copy
>>> dir(copy)
['Error', 'PyStringMap', '_EmptyClass', '__all__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '_copy_dispatch', '_copy_immutable', '_copy_inst',
'_copy_with_constructor', '_copy_with_copy_method', '_deepcopy_atomic', '_deepcopy_dict', '_deepcopy_dispatch', '_deepcopy_inst', '_deepcopy_list', '_deepcopy_method',
'_deepcopy_tuple', '_keep_alive', '_reconstruct', '_test', 'copy', 'deepcopy', 'dispatch_table', 'error', 'name', 't', 'weakref']
>>> [n for n in dir(copy) if not n.startswith('__')]
['Error', 'PyStringMap', '_EmptyClass', '_copy_dispatch', '_copy_immutable', '_copy_inst', '_copy_with_constructor', '_copy_with_copy_method', '_deepcopy_atomic',
'_deepcopy_dict', '_deepcopy_dispatch', '_deepcopy_inst', '_deepcopy_list', '_deepcopy_method', '_deepcopy_tuple', '_keep_alive', '_reconstruct', '_test', 'copy', 'deepcopy',
'dispatch_table', 'error', 'name', 't', 'weakref']
>>> copy.__all__
['Error', 'copy', 'deepcopy']
#用help获取帮助
>>> help(copy.copy)
Help on function copy in module copy:
copy(x)
Shallow copy operation on arbitrary Python objects.
See the module's __doc__ string for more info.
#快速查看函数的参数
>>> print range.__doc__
range(stop) -> list of integers
range(start, stop[, step]) -> list of integers
Return a list containing an arithmetic progression of integers.
range(i, j) returns [i, i+1, i+2, ..., j-1]; start (!) defaults to 0.
When step is given, it specifies the increment (or decrement).
For example, range(4) returns [0, 1, 2, 3]. The end point is omitted!
These are exactly the valid indices for a list of 4 elements.
#查看源码位置,找到对应.py文件打开即可查看
>>> print copy.__file__
D:\Python27\lib\copy.pyc
交互器中python中的帮助使用的更多相关文章
- 浅析python中的装饰器decorator
最近学习python,其中decorator比较难理解,遂写一篇来总结供后续查阅. 定义一个函数,想在运行时动态的改变函数的功能,又不想改变函数本身的代码,可以使用高阶函数(可以使用函数作为参数) 装 ...
- python中的闭包与装饰器
#原创,转载请留言联系 装饰器的本质就是闭包,所以想知道装饰器是什么,首先要理解一下什么是闭包. 闭包 1. 外部函数返回内部函数的引用.2. 内部函数使用外部函数的变量或者参数. def outer ...
- 【Python】解析Python中的装饰器
python中的函数也是对象,函数可以被当作变量传递. 装饰器在python中功能非常强大,装饰器允许对原有函数行为进行扩展,而不用硬编码的方式,它提供了一种面向切面的访问方式. 装饰器 一个普通的装 ...
- Python中的描述器
21.描述器:Descriptors 1)描述器的表现 用到三个魔术方法.__get__() __set__() __delete__() 方法签名如下: object.__get__(self ...
- Python中属性和描述符的简单使用
Python的描述符和属性是接触到Python核心编程中一个比较难以理解的内容,自己在学习的过程中也遇到过很多的疑惑,通过google和阅读源码,现将自己的理解和心得记录下来,也为正在为了该问题苦恼的 ...
- decorator在Python中的作用
decorator(装饰器)在python中作用,可以起到代码复用,也可以起到AOP(面向横切面)的作用. 另外很重要的一点应该就是function在python的世界中是作为一等公民存在的. 在py ...
- 第7.15节 Python中classmethod定义的类方法详解
第7.15节 Python中classmethod定义的类方法详解 类中的方法,除了实例方法外,还有两种方法,分别是类方法和静态方法.本节介绍类方法的定义和使用. 一. 类方法的定义 在类中定 ...
- python cookbook 学习系列(一) python中的装饰器
简介 装饰器本质上是一个Python函数,它可以让其他函数在不需要做任何代码变动的前提下增加额外功能,装饰器的返回值也是一个函数对象.它经常用于有切面需求的场景,比如:插入日志.性能测试.事务处理.缓 ...
- Python中利用函数装饰器实现备忘功能
Python中利用函数装饰器实现备忘功能 这篇文章主要介绍了Python中利用函数装饰器实现备忘功能,同时还降到了利用装饰器来检查函数的递归.确保参数传递的正确,需要的朋友可以参考下 " ...
随机推荐
- 剑指Offer-6.旋转数组的最小数字(C++/Java)
题目: 把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转.输入一个非递减排序的数组的一个旋转,输出旋转数组的最小元素.例如数组{3,4,5,1,2}为{1,2,3,4,5}的一个旋转, ...
- jdk 自带命令行工具
jps工具 虚拟机进程状况工具 工具主要选项 jstat: 虚拟机统计信息监视工具 jinfo: Java配置信息工具 jinfo( Configuration Info for Java) 的作用是 ...
- FFT_应用和例题
卷积 现有两个定义在 N 上的函数 \(f(n),g(n)\),定义 \(f\) 和 \(g\) 的卷积(convolution)为 \(f \otimes g\) \[ (f \otimes g)( ...
- oracle存储过程中循环游标,变量的引用
创建出错时使用: show errors查看具体的错误提示 一. 存储过程中的一个循环及变量引用示例: create or replace procedure my_proiscursor cur i ...
- [转]python 中的[:-1]和[::-1]
转自:https://blog.csdn.net/mingyuli/article/details/81604795 1.案例解释a='python'b=a[::-1]print(b) #nohtyp ...
- python免安装版(绿色版)制作
一.实验环境 1.Windows7x64_SP1 二.需求背景 个人编写了一个软件安装器,用于一键安装开发软件及工具,该工具基于python + pywinauto. 但问题来了,新电脑上未安装pyt ...
- 第八周论文学习03 An Efficient Tree-based Power Saving Scheme for Wireless Sensor Networks with Mobile Sink
来源:IEEE Sensors Journal Year: 2016, Volume: 16, Issue: 20 Pages: 7545 - 7557, DOI: 10.1109/JSEN.2016 ...
- shell脚本语言与linux命令的联系与区别
使用linux肯定是要会使用命令的,就算提供有用户界面,绝大部分功能还是要通过命令行去操作的.而shell脚本语言也是运行在linux上的脚本语言,对于服务器运维人员也是几乎必须要掌握的.而shell ...
- logical函数
logical函数(逻辑函数) logical(x):x ~=0时,logical(x)=1:x = 0时,logical(x)=0
- io机制沉思录:分层与管理
io模型的核心是内核kernel与应用(线程)的关系: 内核与应用的联系:数据状态信号和数据本身: 一.分层模型: 应用层——内核层——设备层 https://www.cnblogs.com/feng ...