import pywikibot
site = pywikibot.Site('test', 'wikipedia')
site
APISite("test", "wikipedia")
page = pywikibot.Page(site, 'test')
page.exists
<bound method BasePage.exists of Page('Test')>
page.exists()
True
page.text
'Hello World'
page.text = 'Hello World'
page.save
<bound method deprecated_args.<locals>.decorator.<locals>.wrapper of Page('Test')>
page.save()
Sleeping for 6.3 seconds, 2019-12-15 15:40:07
Page [[Test]] saved
import pywikibot
site = pywikibot.Site('test', 'wikipedia')
page = pywikibot.Page(site, 'test')
page.text = 'Hello World'
page.save()
Sleeping for 9.4 seconds, 2019-12-15 15:40:14
Page [[Test]] saved
help()
Welcome to Python 3.6's help utility!

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at https://docs.python.org/3.6/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, symbols, or topics, type
"modules", "keywords", "symbols", or "topics".  Each module also comes
with a one-line summary of what it does; to list the modules whose name
or summary contain a given string such as "spam", type "modules spam".


You are now leaving help and returning to the Python interpreter.
If you want to ask for help on a particular object directly from the
interpreter, you can type "help(object)".  Executing "help('string')"
has the same effect as typing a particular string at the help> prompt.
help(page.save)
Help on method save in module pywikibot.page:

save(...) method of pywikibot.page.Page instance
    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
        asynchronously
    @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
        successful.
    @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

help(pywikibot.Page.save)
Help on function save in module pywikibot.page:

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
        asynchronously
    @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
        successful.
    @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

 
import pywikibot
site = pywikibot.Site()
page = pywikibot.Page(site, "Are_You_Experienced")
img_links = list(page.imagelinks())
print(len(img_links))
print(img_links[3].title(as_filename=True, with_ns=False))
0
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-18-f7f8a02cdc20> in <module>
      4 img_links = list(page.imagelinks())
      5 print(len(img_links))
----> 6 print(img_links[3].title(as_filename=True, with_ns=False))

IndexError: list index out of range