.. link: http://dgplug.org/summertraining/2013/posts/bidisha2git-myshellv1-20130719-042036.html .. description: .. tags: .. date: 2013/07/19 04:20:37 .. title: Bidisha2git myshellv1 20130719-042036 .. slug: bidisha2git-myshellv1-20130719-042036 Objective: =============================== To create a code to print "Hi, " when greet command is given and to print the current stock value when stock command is given. code: ================================ from cmd2 import Cmd from getpass import getuser import requests import sys __version__ = '0.1' class Application(Cmd): """ The main Application class """ def __init__(self): Cmd.__init__(self) def do_hello(self, line): print "Hello:", line def do_sayit(self,line): print "Python Rocks!" def do_greet(self,line): print "hi,%s" % (getuser()) def do_stockgoog(self,line): a = requests.get("http://download.finance.yahoo.com/d/quotes.csv?s=GOOG&f=l1") value=a.text print value if __name__ == '__main__': app = Application() app.cmdloop() Link: ==================================