Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 25 Online
OpenStudy (anonymous):

How do I create a text file for a program I've written? Where should I put the extension .py ?

OpenStudy (anonymous):

If you're using IDLE and you're in the window titled "Python Shell," you need to select "New Window" from the File menu. This will open a window in IDLE's text editor, where you can type your program. When you select Save As, you should MANUALLY add the '.py' extension to the end of the filename. Otherwise IDLE will save the file as .txt. You will still be able to run it normally, but you will lose the benefit of IDLE's color coding, smart indent and call tips features. Any .txt file containing valid code can be used as a module, however it's best to change it to type '.py' to take advantage of IDLE's editing features. If your question is "I just typed a series of statements into the Python Shell window; how can I save the process it just completed as a program?" then as far as I know the only way to do that is to manually copy and paste the commands out of the shell and into a new window--just the commands, not the prompts or any output or error messages. You'll have to be careful to maintain correct indentation and formatting if that's what you're trying to do.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
somnium: testing rq
1 hour ago 1 Reply 0 Medals
Lilmunchin: Trump or Biden
1 hour ago 69 Replies 3 Medals
ARTSMART: Art!
4 hours ago 5 Replies 5 Medals
Jasonisyours: What were the key causes of the French Revolution in 1789?
4 hours ago 3 Replies 5 Medals
PureSoulless: Why is the word "Pedophile" always censored in yt vids?
1 day ago 3 Replies 0 Medals
Jalli: What's 58x3634u00b07
1 day ago 6 Replies 3 Medals
arriya: who wanna play roblox
1 day ago 5 Replies 1 Medal
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!