Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW)
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
TheOfficialDevan12: What do you call a pie that is baked into a cake???
1 hour ago 6 Replies 4 Medals
Victorya: what is the square route of 6789?
2 hours ago 2 Replies 1 Medal
CarterorWolfie214: whats 44 times 65
3 hours ago 16 Replies 1 Medal
dukedadon: are there any moderators on rn?
4 hours ago 0 Replies 0 Medals
mdobbs6856: How do you write 7.5E9 in scientific notation?
5 hours ago 2 Replies 2 Medals
594ikfo94: how do i make a group chat
6 hours ago 4 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!