Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 20 days ago.
Improve this question
I am facing a problem when I write the code of python in vs-code. I write the same as showing in video code with harry. But I don't understand how to solve it. Just stop working never do any other task. Here is the code.
input
a = input("what is your name: ")
print("My name is zeeshan", a)
Output
what is your name:
after you run this code you need to type to the console your desired output:
after you see the output
what is your name:
type the name and press enter (then the rest of your code will run)
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have a code that needs to get an input from the console.
I am doing it to be able to debbug a code with input from console becuase pycharm does not allow me to pause during execution.
I want to be able to provided the input i want beforehand , i.e to provide it automatically through the code as if it was provided from the console.
Is this possible?
If you use input(), PyCharm will pause execution to wait for input just as if you run in the console.
Alternatively, you can use sys.argv to take command line parameters. You can add these parameters to the run configuration in pycharm.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I am using Python 3 and asking user for input:
name = input("Please state your name ")
I want the user to see the cursor so they know where the typing is going to happen. I use two spaces after name so they have room between the message and what they type, but would like to have a flashing cursor like this:
Please state your name __
Consult an ANSI vt100 reference, and look for "blinking".
It's not hard to display blinking characters,
and then erase them after input is received.
Here are some characters you might choose to use:
>>> esc = chr(27)
>>> print(f'a{esc}[5m_\u2592b\u2588{esc}[m_c')
a_▒b█_c
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I found this code somewhere in Google.i don't understand how the output is displayed in this sequence.can anyone explain me this?
Code:
def main():
make_omelet()
print("ocean")
def make_omelet():
print("hello")
break_eggs()
print("sos")
def break_eggs():
print("sea")
main()
Output:
hello
sea
sos
ocean
here is the flow that generates the output
main --> make_omelet --> break_eggs
Follow the logic and see how the output is generated,
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Is there a way to actually take a well formatted input and execute it at an appropriate time?
Something like:
num = 5
command = input()
# do something with command
Now, if i enter "print(num)" as input, it should output
5
What you suggest actually works as is:
>>> x=1
>>> eval(input())
print(x)
1
Another method you can have a look at is the exec method (and above that is a detailed description for eval).
Depending on what you are going for this might be a bad idea though. Have a look at the local and global parameters to restrict the environment.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
why the python Cmd module command prompt not using multi-line? it's over writing the same line
example image
I am sorry I don't know, hw to answer ques in stackoverflow, but I found it finally
use self.use_rawinput = False this will fix the problem (If you want a given stdin to be used, make sure to set the instance’s use_rawinput attribute to False, otherwise stdin will be ignored.)
https://docs.python.org/2/library/cmd.html