找回密码
 立即注册

扫一扫,访问微社区

QQ登录

只需一步,快速开始

查看: 5699|回复: 3

[讨论] 模块代码怎么看?很迷茫

4

主题

10

帖子

10

积分

贫民

积分
10
想学习 发表于 2016-11-24 21:34:09 | 显示全部楼层 |阅读模式
2威望
请问下面这些模块里的类代码怎么看?怎么用?,比如下面这些类,是可以实例化的类吗?这些类方法的具体实现在哪可以查询得到!!!!!
CLASSES
    __builtin__.object
        nt.stat_result
        nt.statvfs_result
    exceptions.EnvironmentError(exceptions.StandardError)
        exceptions.OSError
    error = class OSError(EnvironmentError)
     |  OS system call failed.
     |
     |  Method resolution order:
     |      OSError
     |      EnvironmentError
     |      StandardError
     |      Exception
     |      BaseException
     |      __builtin__.object
     |
     |  Methods defined here:
     |
     |  __init__(...)
     |      x.__init__(...) initializes x; see help(type(x)) for signature
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |
     |  __new__ = <built-in method __new__ of type object>
     |      T.__new__(S, ...) -> a new object with type S, a subtype of T
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from EnvironmentError:
     |
     |  __reduce__(...)
     |
     |  __str__(...)
     |      x.__str__() <==> str(x)
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from EnvironmentError:
     |
     |  errno
     |      exception errno
     |
     |  filename
     |      exception filename
     |
     |  strerror
     |      exception strerror
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from BaseException:
     |
     |  __delattr__(...)
     |      x.__delattr__('name') <==> del x.name
     |
     |  __getattribute__(...)
     |      x.__getattribute__('name') <==> x.name
     |
     |  __getitem__(...)
     |      x.__getitem__(y) <==> x[y]
     |
     |  __getslice__(...)
     |      x.__getslice__(i, j) <==> x[i:j]
     |
     |      Use of negative indices is not supported.
     |
     |  __repr__(...)
     |      x.__repr__() <==> repr(x)
     |
     |  __setattr__(...)
     |      x.__setattr__('name', value) <==> x.name = value
     |
     |  __setstate__(...)
     |
     |  __unicode__(...)
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from BaseException:
     |
     |  __dict__
     |
     |  args
     |
     |  message
    class stat_result(__builtin__.object)
     |  stat_result: Result from stat or lstat.
     |
     |  This object may be accessed either as a tuple of
     |    (mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime)
     |  or via the attributes st_mode, st_ino, st_dev, st_nlink, st_uid, and so on.
     |
     |  Posix/windows: If your platform supports st_blksize, st_blocks, st_rdev,
     |  or st_flags, they are available as attributes only.
     |
     |  See os.stat for more information.
     |
     |  Methods defined here:
     |
     |  __add__(...)
     |      x.__add__(y) <==> x+y
     |
     |  __contains__(...)
     |      x.__contains__(y) <==> y in x
     |
     |  __eq__(...)
     |      x.__eq__(y) <==> x==y
     |
     |  __ge__(...)
     |      x.__ge__(y) <==> x>=y
     |
     |  __getitem__(...)
     |      x.__getitem__(y) <==> x[y]
     |
     |  __getslice__(...)
     |      x.__getslice__(i, j) <==> x[i:j]
     |
     |      Use of negative indices is not supported.
     |
     |  __gt__(...)
     |      x.__gt__(y) <==> x>y
     |
     |  __hash__(...)
     |      x.__hash__() <==> hash(x)
     |
     |  __le__(...)
     |      x.__le__(y) <==> x<=y
     |
     |  __len__(...)
     |      x.__len__() <==> len(x)
     |
     |  __lt__(...)
     |      x.__lt__(y) <==> x<y
     |
     |  __mul__(...)
     |      x.__mul__(n) <==> x*n
     |
     |  __ne__(...)
     |      x.__ne__(y) <==> x!=y
     |
     |  __reduce__(...)
     |
     |  __repr__(...)
     |      x.__repr__() <==> repr(x)
     |
     |  __rmul__(...)
     |      x.__rmul__(n) <==> n*x
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  st_atime
     |      time of last access
     |
     |  st_ctime
     |      time of last change
     |
     |  st_dev
     |      device
     |
     |  st_gid
     |      group ID of owner
     |
     |  st_ino
     |      inode
     |
     |  st_mode
     |      protection bits
     |
     |  st_mtime
     |      time of last modification
     |
     |  st_nlink
     |      number of hard links
     |
     |  st_size
     |      total size, in bytes
     |
     |  st_uid
     |      user ID of owner
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |
     |  __new__ = <built-in method __new__ of type object>
     |      T.__new__(S, ...) -> a new object with type S, a subtype of T
     |
     |  n_fields = 13
     |
     |  n_sequence_fields = 10
     |
     |  n_unnamed_fields = 3
    class statvfs_result(__builtin__.object)
     |  statvfs_result: Result from statvfs or fstatvfs.
     |
     |  This object may be accessed either as a tuple of
     |    (bsize, frsize, blocks, bfree, bavail, files, ffree, favail, flag, namemax),
     |  or via the attributes f_bsize, f_frsize, f_blocks, f_bfree, and so on.
     |
     |  See os.statvfs for more information.
     |
     |  Methods defined here:
     |
     |  __add__(...)
     |      x.__add__(y) <==> x+y
     |
     |  __contains__(...)
     |      x.__contains__(y) <==> y in x
     |
     |  __eq__(...)
     |      x.__eq__(y) <==> x==y
     |
     |  __ge__(...)
     |      x.__ge__(y) <==> x>=y
     |
     |  __getitem__(...)
     |      x.__getitem__(y) <==> x[y]
     |
     |  __getslice__(...)
     |      x.__getslice__(i, j) <==> x[i:j]
     |
     |      Use of negative indices is not supported.
     |
     |  __gt__(...)
     |      x.__gt__(y) <==> x>y
     |
     |  __hash__(...)
     |      x.__hash__() <==> hash(x)
     |
     |  __le__(...)
     |      x.__le__(y) <==> x<=y
     |
     |  __len__(...)
     |      x.__len__() <==> len(x)
     |
     |  __lt__(...)
     |      x.__lt__(y) <==> x<y
     |
     |  __mul__(...)
     |      x.__mul__(n) <==> x*n
     |
     |  __ne__(...)
     |      x.__ne__(y) <==> x!=y
     |
     |  __reduce__(...)
     |
     |  __repr__(...)
     |      x.__repr__() <==> repr(x)
     |
     |  __rmul__(...)
     |      x.__rmul__(n) <==> n*x
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  f_bavail
     |
     |  f_bfree
     |
     |  f_blocks
     |
     |  f_bsize
     |
     |  f_favail
     |
     |  f_ffree
     |
     |  f_files
     |
     |  f_flag
     |
     |  f_frsize
     |
     |  f_namemax
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |
     |  __new__ = <built-in method __new__ of type object>
     |      T.__new__(S, ...) -> a new object with type S, a subtype of T
     |
     |  n_fields = 10
     |
     |  n_sequence_fields = 10
     |
     |  n_unnamed_fields = 0

回复

使用道具 举报

4

主题

10

帖子

10

积分

贫民

积分
10
想学习  楼主| 发表于 2016-11-26 22:37:54 | 显示全部楼层
就没有大神可以分享一下自己的经验吗
回复

使用道具 举报

1

主题

2

帖子

2

积分

贫民

积分
2
liuyifa 发表于 2017-2-8 11:34:08 | 显示全部楼层
mark一下,我也想知道,教程上说,不懂就用help,dir, __doc__来寻求帮助,但是只能看到如版主贴出的东东,还是看的不是很明白
回复

使用道具 举报

0

主题

33

帖子

33

积分

贫民

积分
33
jackyspy 发表于 2017-3-2 16:24:12 | 显示全部楼层
C模块当然看不到源码。当然Python内置的模块可以看Python源码。不过那是另外一个故事……
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表