I have some code here:
import urllib
import subprocess
import time
open_site=urllib.urlopen("http://www.freewebs.com/sravan953/command_python.html")
read_site=open_site.read()
site_list=[]
for a in read_site:
if a=='<':
break
elif a!='<':
site_list.append(a)
site_list.remove('\n')
site_list.remove('\n')
site_list.remove('\r')
for a in site_list:
site_string=''.join(site_list)
def run_program():
current=time.asctime()
print 'Runnning program'+' ['+current+']'
subprocess.call(site_string)
def check_argument():
current=time.asctime()
if str=='':
print 'No command given'+' ['+current+']'
timer()
else:
print 'Command found...'+' ['+current+']'
run_program()
def timer():
current=time.asctime()
print 'Checking for commands...'+' ['+current+']'
time.sleep(30)
check_argument()
timer()
How can I intervene the loop, like at any time if the user enters 'QUIT', the program has to stop...any ideas on how I can go about this?
Thanks