OpenStudy (anonymous):

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

7 years ago
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.

7 years ago
Similar Questions: