In [1]:
import pywikibot
In [2]:
site = pywikibot.Site('test', 'wikipedia')
In [3]:
APISite("test", "wikipedia")
In [4]:
page = pywikibot.Page(site, 'test')
In [5]:
In [6]:
'hello wiki\n\nhiya\n\nHello 2\n\nHello 3'
In [7]:
page.text = 'Hello world'
In [8]:
import pywikibot

site = pywikibot.Site('test', 'wikipedia')
page = pywikibot.Page(site, 'test')

page.text = 'Hello world!'
Page [[Test]] saved
In [9]:
Help on function save in module

save(self, summary=None, watch=None, minor=True, botflag=None, force=False, asynchronous=False, callback=None, apply_cosmetic_changes=None, quiet=False, **kwargs, comment='[deprecated name of summary]', sysop=NotImplemented, async='[deprecated name of asynchronous]')
    Save the current contents of page's text to the wiki.
    @param summary: The edit summary for the modification (optional, but
        most wikis strongly encourage its use)
    @type summary: str
    @param watch: Specify how the watchlist is affected by this edit, set
        to one of "watch", "unwatch", "preferences", "nochange":
        * watch: add the page to the watchlist
        * unwatch: remove the page from the watchlist
        * preferences: use the preference settings (Default)
        * nochange: don't change the watchlist
        If None (default), follow bot account's default settings
        For backward compatibility watch parameter may also be boolean:
        if True, add or if False, remove this Page to/from bot
        user's watchlist.
    @type watch: str, bool (deprecated) or None
    @param minor: if True, mark this edit as minor
    @type minor: bool
    @param botflag: if True, mark this edit as made by a bot (default:
        True if user has bot status, False if not)
    @param force: if True, ignore botMayEdit() setting
    @type force: bool
    @param asynchronous: if True, launch a separate thread to save
    @param callback: a callable object that will be called after the
        page put operation. This object must take two arguments: (1) a
        Page object, and (2) an exception instance, which will be None
        if the page was saved successfully. The callback is intended for
        use by bots that need to keep track of which saves were
    @param apply_cosmetic_changes: Overwrites the cosmetic_changes
        configuration value to this value unless it's None.
    @type apply_cosmetic_changes: bool or None
    @param quiet: enable/disable successful save operation message;
        defaults to False.
        In asynchronous mode, if True, it is up to the calling bot to
        manage the output e.g. via callback.
    @type quiet: bool

In [10]:
import pywikibot
from pywikibot import pagegenerators
site = pywikibot.Site()
cat = pywikibot.Category(site,'Category:Living people')
gen = pagegenerators.CategorizedPageGenerator(cat)
for page in gen:
    #Do something with the page object, for example:
    text = page.text
In [ ]: