In [4]:
import wikipedia as w

In [24]:
print w.summary("India", sentences=2)
print w.summary("India", chars=200)


India, officially the Republic of India (IAST: Bhārat Gaṇarājya), is a country in South Asia. It is the seventh-largest country by area, the second-most populous country (with over 1.2 billion people), and the most populous democracy in the world.
India, officially the Republic of India (IAST: Bhārat Gaṇarājya), is a country in South Asia. It is the seventh-largest country by area, the second-most populous country (with over 1.2 billion people)...

In [13]:
try:
    print w.summary("India", sentences=2)
except PageError:
    print "No wikipedia page found for given word(s)"


India, officially the Republic of India (IAST: Bhārat Gaṇarājya), is a country in South Asia. It is the seventh-largest country by area, the second-most populous country (with over 1.2 billion people), and the most populous democracy in the world.

In [22]:
#print w.summary("IndiaSomePage", sentences=2)
try:
    print w.summary("IndiaSomePage", sentences=2)
except wikipedia.exceptions.PageError as e:
    print "No wikipedia page found for given word(s)"


No wikipedia page found for given word(s)