Python print() not working on my PC | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Python print() not working on my PC

I created the python "a.py". Write inside the below. x = input ("Entre interger") print (x) When I export .py to .exe, print() function not working. Show "Entre interger", I key in integer, then the program end. don't show the value of x. Please help. When I run in IDLE, the program works.

5th May 2019, 12:58 AM
Kyaw Myo Oo
Kyaw Myo Oo - avatar
4 Answers
+ 2
What do you do to convert the .py to an .exe? How do you run the .exe? Does it run in a new console window? Is it possible that the console window just immediately closes after showing the output so that it looks like it doesn't show anything?
5th May 2019, 4:46 AM
Anna
Anna - avatar
+ 2
Kyaw Myo when you created a program into .exe after the program finished, the console usually quits automatically. so, what i usually do is put an extra input() at the end to avoid ending the program until you pressed enter. here is the correct code x = input("enter integer") print(x) input()
5th May 2019, 8:47 AM
Shen Bapiro
Shen Bapiro - avatar
0
Converted exe file by using pyinstaller in command prompt.
5th May 2019, 4:59 AM
Kyaw Myo Oo
Kyaw Myo Oo - avatar
0
Thanks bro, let me try.
5th May 2019, 9:19 AM
Kyaw Myo Oo
Kyaw Myo Oo - avatar