[英]get user input when i run python program through pythonw.exe
How can i run python programm as background process and show cmd for input and output operation only. 我如何才能将python programm作为后台进程运行,并仅显示cmd用于输入和输出操作。 consider the following code: 考虑以下代码:
import pyttsx3;
import pickle;
import speech_recognition as sr
engine = pyttsx3.init();
rate = engine.getProperty('rate')
engine.setProperty('rate', rate-25)
volume = engine.getProperty('volume')
engine.setProperty('volume', volume+0.50)
mic_name = "USB Device 0x46d:0x825: Audio (hw:1, 0)"
sample_rate = 8000
chunk_size = 128
r = sr.Recognizer()
mic_list = sr.Microphone.list_microphone_names()
engine.say(" Hello Mr.amit , welcome to the first project");
engine.runAndWait();
engine.say("please enter username and password ");
engine.runAndWait();
print("please enter username and password")
c=input("Username:")
d=input("Password:")
ss=0
pickle_in = open("dictpersonal.pickle","rb")
users= pickle.load(pickle_in)
for us in users:
if(c==us):
engine.say("log in successfully");
engine.runAndWait();
print("log in successfully as =",c);
ss=ss+1;
break;
if(ss==0):
engine.say("Username not found.Want to sign up using this username,enter y ");
all i want is to open cmd only when an input or output operation is required.if i use pythonw.exe to run this program 我只想在需要输入或输出操作的情况下打开cmd。如果我使用pythonw.exe运行此程序
pythonw.exe C:\Users\amit\Desktop\MachineLearning\Projects\Personal\f3.py
i can not insert username and password 我无法输入用户名和密码
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.