MediaWiki API 结果

这是JSON格式的HTML实现。HTML对调试很有用,但不适合应用程序使用。

指定format参数以更改输出格式。要查看JSON格式的非HTML实现,设置format=json

参见完整文档,或API帮助以获取更多信息。

{
    "batchcomplete": "",
    "continue": {
        "gapcontinue": "Redis-bigkeys",
        "continue": "gapcontinue||"
    },
    "warnings": {
        "main": {
            "*": "Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."
        },
        "revisions": {
            "*": "Because \"rvslots\" was not specified, a legacy format has been used for the output. This format is deprecated, and in the future the new format will always be used."
        }
    },
    "query": {
        "pages": {
            "476": {
                "pageid": 476,
                "ns": 0,
                "title": "Re.search\u65b9\u6cd5",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "==re.search\u65b9\u6cd5==\n<pre>\nre.search \u626b\u63cf\u6574\u4e2a\u5b57\u7b26\u4e32\u5e76\u8fd4\u56de\u7b2c\u4e00\u4e2a\u6210\u529f\u7684\u5339\u914d\u3002\n\n\u51fd\u6570\u8bed\u6cd5\uff1a\nre.search(pattern, string, flags=0)\n\n\u51fd\u6570\u53c2\u6570\u8bf4\u660e\uff1a\n\n\u53c2\u6570       \t   \u63cf\u8ff0\npattern\t \u5339\u914d\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\nstring\t     \u8981\u5339\u914d\u7684\u5b57\u7b26\u4e32\u3002\nflags\t     \u6807\u5fd7\u4f4d\uff0c\u7528\u4e8e\u63a7\u5236\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5339\u914d\u65b9\u5f0f\uff0c\u5982\uff1a\u662f\u5426\u533a\u5206\u5927\u5c0f\u5199\uff0c\u591a\u884c\u5339\u914d\u7b49\u7b49\u3002\n\n\n\u5339\u914d\u6210\u529fre.search\u65b9\u6cd5\u8fd4\u56de\u4e00\u4e2a\u5339\u914d\u7684\u5bf9\u8c61\uff0c\u5426\u5219\u8fd4\u56deNone\u3002\n\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528group(num) \u6216 groups() \u5339\u914d\u5bf9\u8c61\u51fd\u6570\u6765\u83b7\u53d6\u5339\u914d\u8868\u8fbe\u5f0f\u3002\n\n \u5339\u914d\u5bf9\u8c61\u65b9\u6cd5\t          \u63cf\u8ff0\ngroup(num=0)\t   \u5339\u914d\u7684\u6574\u4e2a\u8868\u8fbe\u5f0f\u7684\u5b57\u7b26\u4e32\uff0cgroup() \u53ef\u4ee5\u4e00\u6b21\u8f93\u5165\u591a\u4e2a\u7ec4\u53f7\uff0c\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\u5b83\u5c06\u8fd4\u56de\u4e00\u4e2a\u5305\u542b\u90a3\u4e9b\u7ec4\u6240\u5bf9\u5e94\u503c\u7684\u5143\u7ec4\u3002\ngroups()\t      \u8fd4\u56de\u4e00\u4e2a\u5305\u542b\u6240\u6709\u5c0f\u7ec4\u5b57\u7b26\u4e32\u7684\u5143\u7ec4\uff0c\u4ece 1 \u5230 \u6240\u542b\u7684\u5c0f\u7ec4\u53f7\u3002\n\n\u5b9e\u4f8b \n#!/usr/bin/python\nimport re\n \nline = \"Cats are smarter than dogs\";\n \nsearchObj = re.search( r'(.*) are (.*?) .*', line, re.M|re.I)\n \nif searchObj:\n   print \"searchObj.group() : \", searchObj.group()\n   print \"searchObj.group(1) : \", searchObj.group(1)\n   print \"searchObj.group(2) : \", searchObj.group(2)\nelse:\n   print \"Nothing found!!\"\n\n\n\u4ee5\u4e0a\u5b9e\u4f8b\u6267\u884c\u7ed3\u679c\u5982\u4e0b\uff1a\nsearchObj.group() :  Cats are smarter than dogs\nsearchObj.group(1) :  Cats\nsearchObj.group(2) :  smarter\n\n\nre.match\u4e0ere.search\u7684\u533a\u522b\nre.match\u53ea\u5339\u914d\u5b57\u7b26\u4e32\u7684\u5f00\u59cb\uff0c\u5982\u679c\u5b57\u7b26\u4e32\u5f00\u59cb\u4e0d\u7b26\u5408\u6b63\u5219\u8868\u8fbe\u5f0f\uff0c\u5219\u5339\u914d\u5931\u8d25\uff0c\u51fd\u6570\u8fd4\u56deNone\uff1b\u800cre.search\u5339\u914d\u6574\u4e2a\u5b57\u7b26\u4e32\uff0c\u76f4\u5230\u627e\u5230\u4e00\u4e2a\u5339\u914d\u3002\n\ngroup([group1, \u2026]): \n\u83b7\u5f97\u4e00\u4e2a\u6216\u591a\u4e2a\u5206\u7ec4\u622a\u83b7\u7684\u5b57\u7b26\u4e32\uff1b\u6307\u5b9a\u591a\u4e2a\u53c2\u6570\u65f6\u5c06\u4ee5\u5143\u7ec4\u5f62\u5f0f\u8fd4\u56de\u3002group1\u53ef\u4ee5\u4f7f\u7528\u7f16\u53f7\u4e5f\u53ef\u4ee5\u4f7f\u7528\u522b\u540d\uff1b\u7f16\u53f70\u4ee3\u8868\u6574\u4e2a\u5339\u914d\u7684\u5b50\u4e32\uff1b\u4e0d\u586b\u5199\u53c2\u6570\u65f6\uff0c\u8fd4\u56degroup(0)\uff1b\u6ca1\u6709\u622a\u83b7\u5b57\u7b26\u4e32\u7684\u7ec4\u8fd4\u56deNone\uff1b\u622a\u83b7\u4e86\u591a\u6b21\u7684\u7ec4\u8fd4\u56de\u6700\u540e\u4e00\u6b21\u622a\u83b7\u7684\u5b50\u4e32\u3002\n</pre>\n\n==\u53c2\u8003==\nPython\u6b63\u5219\u8868\u8fbe\u5f0f\n\nhttp://www.runoob.com/python/python-reg-expressions.html\n\n[[category:python]]"
                    }
                ]
            },
            "477": {
                "pageid": 477,
                "ns": 0,
                "title": "Realvnc",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "\n realvnc\n\nhttps://www.realvnc.com/download/vnc/linux/\n\n&nbsp;\n\nhttps://www.realvnc.com/docs/debian-install-remove.html\n\n&nbsp;\n\n&nbsp;\n\n[[Category:ops]][[Category:linux]]"
                    }
                ]
            }
        }
    }
}