python怎么查看类的方法_python中查看一个对象的方法

先输入python进入python环境

例如:

>>> import json

>>> help(json)

可以看到这样的结果:

Help on package json:

NAME

json - A simple, fast, extensible JSON encoder and decoder

FILE

/usr/lib64/python2.6/json/__init__.py

DESCRIPTION

JSON (JavaScript Object Notation) is a subset of

JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data

interchange format.

json exposes an API familiar to uses of the standard library

marshal and pickle modules.

Encoding basic Python object hierarchies::

>>> import json

>>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])

'["foo", {"bar": ["baz", null, 1.0, 2]}]'

>>> print json.dumps("\"foo\bar")

"\"foo\bar"

>>> print json.dumps(u'\u1234')

"\u1234"

>>> print json.dumps('\\')

"\\"

>>> print json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True)

{"a": 0, "b": 0, "c": 0}

>>> from StringIO import StringIO

>>> io = StringIO()

>>> json.dump(['streaming API'], io)

>>> io.getvalue()

'["streaming API"]'

Compact encoding::

>>> import json

>>> json.dumps([1,2,3,{'4': 5, '6': 7}], sort_keys=True, separators=(',',':'))

'[1,2,3,{"4":5,"6":7}]'

.............................

分享到:

2013-09-09 09:37

浏览 5049

评论

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值