site = pywikibot.Site('test', 'wikipedia')
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-1-1cdad9b54124> in <module>
----> 1 site = pywikibot.Site('test', 'wikipedia')

NameError: name 'pywikibot' is not defined
import pywikibot
site = pywikibot.Site('test', 'wikipedia')
page = pywikibot.Page(site, 'test')
print(page.text)
Hello world
page.text += " !!!"
print(page.text)
Hello world !!!
page.save()
Page [[Test]] saved