Problem- Generate a program in python which will generate two commands using the cmd package.
Description
Import cmd, os, urllib2
class myshell defines two functions do_greet(), do_stock()
do_greet function will take the user name from the system and reflect the result as hi username when the command hi is executed.
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
- 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