def do_POST(self): if self.path.startswith('/voice'): voice = Voice() phrase = self.path.replace('/voice/','').replace('%20',' ') print phrase voice.spell(' '+phrase) self.path = '/webapp/index.html' return SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)
def main(argv): stringText = '' try: opts, args = getopt.getopt(argv, "hs:t:", ["s=", "time="]) except getopt.GetoptError: print 'voice.py -s <stringText> -t' sys.exit(2) for opt, arg in opts: if opt == '-s': voice = Voice() voice.spell(stringText) sys.exit() elif opt in ("-t", "--time"): voice = Voice() voice.time() sys.exit()
def main(argv): stringText = '' try: opts, args = getopt.getopt(argv,"hs:t:",["s=","time="]) except getopt.GetoptError: print 'voice.py -s <stringText> -t' sys.exit(2) for opt, arg in opts: if opt == '-s': voice = Voice() voice.spell(stringText) sys.exit() elif opt in ("-t", "--time"): voice = Voice() voice.time() sys.exit()