def do_wiki(self, s): """Jarvis will get wiki details for you""" k = s.split(' ', 1) data = None if k[0] == "search": data = wiki.search(" ".join(k[1:])) elif k[0] == "summary": data = wiki.summary(" ".join(k[1:])) elif k[0] == "content": data = wiki.content(" ".join(k[1:])) if isinstance(data, list): print "\nDid you mean one of these pages?\n" for d in range(len(data)): print(str(d + 1) + ": " + data[d]) else: print("\n" + data)
def do_wiki(self, s): """Jarvis will get wiki details for you""" #ERROR if only uses wiki or wiki search without keyword k = s.split(' ', 1) data = None if k[0] == "search": data = wiki.search(" ".join(k[1:])) elif k[0] == "summary": data = wiki.summary(" ".join(k[1:])) elif k[0] == "content": data = wiki.content(" ".join(k[1:])) if isinstance(data, list): print("\nDid you mean one of these pages?\n") for d in range(len(data)): print(str(d + 1) + ": " + data[d]) # Jarvis don't let to choose over these results else: print("\n" + data)