我是一名PHP開發人員,我曾在PHP中使用$_SERVER['QUERY_STRING']
獲取查詢字符串。
這是什麼Python 2.7語法?
import web
import speech_recognition as sr
from os import path
urls = (
'/voice', 'Voice'
)
app = web.application(urls, globals())
class Voice:
def GET(self):
WAV_FILE = path.join(path.dirname(path.realpath("C:\Python27")),'wavfile.wav')
r = sr.Recognizer()
with sr.WavFile("C:\Python27\wavfile.wav") as source:
audio = r.record(source) # read the entire WAV file
output = r.recognize_google(audio)
return output
if __name__ == "__main__":
app.run()
使用任何特定的框架? – Chris
不,更新了問題。 –
我認爲答案是一個特定的框架。它看起來像你使用['web.py'](http://webpy.org/)? – Chris