亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

json.dumps

json.dumps是什么函數?

正在回答

4 回答

JSON(JavaScript Object Notation) 是一種輕量級的數據交換格式。它基于JavaScript的一個子集。 JSON采用完全獨立于語言的文本格式,但是也使用了類似于C語言家族的習慣(包括C, C++, C#, Java, JavaScript, Perl, Python等)。這些特性使JSON成為理想的數據交換語言。易于人閱讀和編寫,同時也易于機器解析和生成。


編碼:把一個Python對象編碼轉換成Json字符串 ? json.dumps()

解碼:把Json格式字符串解碼轉換成Python對象?? json.loads()


3 回復 有任何疑惑可以回復我~
#1

慕粉100117686

厲害厲害
2017-05-25 回復 有任何疑惑可以回復我~
#2

inkale

那為什么要 json.dumps({'python':2.7}) 這串代碼干了什么
2017-08-13 回復 有任何疑惑可以回復我~

我也想知道json.dumps()是什么函數?

0 回復 有任何疑惑可以回復我~

Help on function dumps in module json:

dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, encoding='utf-8', default=None, sort_keys=False, **kw)
? ?Serialize ``obj`` to a JSON formatted ``str``.
? ?
? ?If ``skipkeys`` is false then ``dict`` keys that are not basic types
? ?(``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)
? ?will be skipped instead of raising a ``TypeError``.
? ?
? ?If ``ensure_ascii`` is false, all non-ASCII characters are not escaped, and
? ?the return value may be a ``unicode`` instance. See ``dump`` for details.
? ?
? ?If ``check_circular`` is false, then the circular reference check
? ?for container types will be skipped and a circular reference will
? ?result in an ``OverflowError`` (or worse).
? ?
? ?If ``allow_nan`` is false, then it will be a ``ValueError`` to
? ?serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in
? ?strict compliance of the JSON specification, instead of using the
? ?JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``).
? ?
? ?If ``indent`` is a non-negative integer, then JSON array elements and
? ?object members will be pretty-printed with that indent level. An indent
? ?level of 0 will only insert newlines. ``None`` is the most compact
? ?representation. ?Since the default item separator is ``', '``, ?the
? ?output might include trailing whitespace when ``indent`` is specified.
? ?You can use ``separators=(',', ': ')`` to avoid this.
? ?
? ?If ``separators`` is an ``(item_separator, dict_separator)`` tuple
? ?then it will be used instead of the default ``(', ', ': ')`` separators.
? ?``(',', ':')`` is the most compact JSON representation.
? ?
? ?``encoding`` is the character encoding for str instances, default is UTF-8.
? ?
? ?``default(obj)`` is a function that should return a serializable version
? ?of obj or raise TypeError. The default simply raises TypeError.
? ?
? ?If *sort_keys* is ``True`` (default: ``False``), then the output of
? ?dictionaries will be sorted by key.
? ?
? ?To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the
? ?``.default()`` method to serialize additional types), specify it with
? ?the ``cls`` kwarg; otherwise ``JSONEncoder`` is used.

0 回復 有任何疑惑可以回復我~
import?jsom
help(jsom.dumps)


0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
python進階
  • 參與學習       255563    人
  • 解答問題       3038    個

學習函數式、模塊和面向對象編程,掌握Python高級程序設計

進入課程
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號