import sys

if __name__ == '__main__':
	userinput = '0' 


	while(userinput != '3' ):
        	#global user_input
		print "First Time"
		print userinput
        	print "\n\t Enter a choice : 1) Save data to File.  2) Display on scree. 3) Exit "
        	userinput = str(raw_input("\n\tSome input please: ex 1 or 2  as per above msg :  "))
		print "Second Time"
		print userinput
        	if (userinput == '1'):
                	stockDownload = StockDownload()
                	stockDownload.downloadStockCsv()
		        sys.exit(1)	
			#user_input = '3'

        	elif (userinput == '2'):
                	stockDownload = StockDownload()
                	stockDownload.downloadStockCsv()
                	vardisplay = Display()
                	vardisplay.display()
                	#break
		        sys.exit(1)	
			#user_input = '3'

        	else:
             		print "\n\t Invalid Input"
예제 #2
0
os.system('clear') 
user_input = 0

while(user_input != 3):
	"""
	Read user input to take appropriate action.
	"""
        print (menu_msg)
        user_input = input(user_input_msg)
	user_input = int(user_input)
        if (user_input == 1):
		'''
		Download stock file and save it.
		'''
               	stockDownload = StockDownload()
               	result=stockDownload.downloadStockCsv(url_string,file_path)
		if(result):
			print ("\n********************************************************************************************************** ")
			print ( "\n\t"+file_path+"   " + success_msg + "   created")
			print ("\n********************************************************************************************************** ")
		else:
			print (fail_msg)

       	elif (user_input == 2):
		'''
		Read the stock data from the given URL and display it on console
		'''
               	stockDownload = StockDownload()
               	result=stockDownload.downloadStockCsv(url_string,newfile_path)
		if(result):