I have a program that comminucate with user. I'm taking data from user with input()
but, I want to tell user, for example if user typing a swearword, I want to print You are swearing! Delete it immediately!
while user is typing.
As you know, firstly Python is waiting for until input()
is done. My goal is access to input()
before it's done then I can print You are swearing! Delete it immediately!
while user typing.
There is too many dicts and functions in my program so I'm going to write an example that relevant about my main problem.
print ("Let's talk..")
isim=input("What's your name?: ")
print ("Hi there {}.".format(isim))
no=["badwords","morebadwords"]
while True:
user=input(u">>>{}: ".format(isim)).lower()
for ct in user.split():
if ct in no:
print ("You are swearing! Delete it immediately! ")
But it's not working because Python is waiting first until user
input is done. How can I do this while user is typing? -Python 3.4, Windows-