Psyduck - 可達鴨 之 鴨力山大2


Server : LiteSpeed
System : Linux premium217.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User : alloknri ( 880)
PHP Version : 8.1.34
Disable Function : NONE
Directory :  /lib64/python2.7/json/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib64/python2.7/json/tool.py
r"""Command-line tool to validate and pretty-print JSON

Usage::

    $ echo '{"json":"obj"}' | python -m json.tool
    {
        "json": "obj"
    }
    $ echo '{ 1.2:3.4}' | python -m json.tool
    Expecting property name enclosed in double quotes: line 1 column 3 (char 2)

"""
import sys
import json

def main():
    if len(sys.argv) == 1:
        infile = sys.stdin
        outfile = sys.stdout
    elif len(sys.argv) == 2:
        infile = open(sys.argv[1], 'rb')
        outfile = sys.stdout
    elif len(sys.argv) == 3:
        infile = open(sys.argv[1], 'rb')
        outfile = open(sys.argv[2], 'wb')
    else:
        raise SystemExit(sys.argv[0] + " [infile [outfile]]")
    with infile:
        try:
            obj = json.load(infile)
        except ValueError, e:
            raise SystemExit(e)
    with outfile:
        json.dump(obj, outfile, sort_keys=True,
                  indent=4, separators=(',', ': '))
        outfile.write('\n')


if __name__ == '__main__':
    main()
Name
Size
Permissions
Options
__init__.py
14.376 KB
-rw-r--r--
__init__.pyc
13.6 KB
-rw-r--r--
__init__.pyo
13.6 KB
-rw-r--r--
decoder.py
13.377 KB
-rw-r--r--
decoder.pyc
11.68 KB
-rw-r--r--
decoder.pyo
11.68 KB
-rw-r--r--
encoder.py
16.015 KB
-rw-r--r--
encoder.pyc
13.399 KB
-rw-r--r--
encoder.pyo
13.399 KB
-rw-r--r--
scanner.py
2.243 KB
-rw-r--r--
scanner.pyc
2.177 KB
-rw-r--r--
scanner.pyo
2.177 KB
-rw-r--r--
tool.py
0.974 KB
-rw-r--r--
tool.pyc
1.264 KB
-rw-r--r--
tool.pyo
1.264 KB
-rw-r--r--