Jump to content
Sign in to follow this  
PierreC

Get the propt value of input()

Recommended Posts

Hello everyone,

 

I have another question: is there a way to get the prompt argument of the python input() function?

For example if the python code is 

input("Please, give me a number")

I would like to get this string when dealing with the OnReceiveData or OnReceiveUniData events.

Share this post


Link to post

You cant't, at least  not easily.

 

The input function writes to stdout the message and then reads from stdin the input. The two operations are separate.  You may be able to guess from what was written to sys.stdout last.

But what you can do is overwrite builtins.input with your own function.

Edited by pyscripter

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×