Christina-B myshellv1 20130718-165300


Posted:

Problem- Generate a program in python which will generate two commands using the cmd package.

Description

  1. Import cmd, os, urllib2

  2. class myshell defines two functions do_greet(), do_stock()

  3. do_greet function will take the user name from the system and reflect the result as hi username when the command hi is executed.

  4. do_stock will take the symbol of the company and print the stock value for this urlopen() is used.

    Click the link below to see the program

    link

    Execute the program using following command

    $ chmod +x myshellv1.py

    $ python myshellv1.py

    OUTPUT

    (cmd) greet

    Will produce--> Hi christina

    (cmd) stock GOOG

    Will produce--> Stock value is 914.90

Contents © 2013 dgplug - Powered by Nikola
Share
UA-42392315-1