Manual:Pywikibot/Create your own script/zh

这个页面列出一些非常基础的提示来让你开始写你自己的机器人. 请确保设置你的 user-config.py 文件.

你也可以在shell或者脚本中使用下列的命令.

打开shell，运行 ;

As a script, please save the file as 'myscript.py' in the 'scripts/' directory; then run.


 * To gain access to the pywikipedia framework, use:


 * to retrieve a page, use the following, where pageName is the title of the page you would like to retrieve, e.g., "Wikipedia:Bots" or "India":


 * to update a page, use:


 * look at some of the pywikibot files for other ideas -- scripts/basic.py is relatively easy to read even if you're new to pywikibot.


 * you can find all available Page methods in the pywikibot/page.py file.


 * basic.py gives you a setup that can be used for many different bots, all you have to do is define the string editing on the page text.


 * To iterate over a set of pages, see pywikibot/pagegenerators.py for some objects that return a set of pages. An example use of the CategoryPageGenerator that does something for each page in the Category:Living people category: