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

Hi guys, how can I save a script and run it in the Shell? thx!

OpenStudy (anonymous):

If you're using IDLE, while the interpreter is running, just press ctrl+N. This will open a code editor, which you can write in, run code in, save in .py format, or do other useful things. While in the code editor, F5 will run the script in the interpreter. If you've already written your code in notepad or something, just change the extension from .txt to .py.

OpenStudy (anonymous):

You are awesome! thx!

OpenStudy (anonymous):

Interesting- I didn't know you could save a notepad document as python. Very useful!

OpenStudy (anonymous):

Well notepad is just a raw text editor. It doesn't format or otherwise do anything to the text inputted into it, so the only data in the file is nothing but the raw text itself. Since python script (and probably most languages) are also just code written in raw text, it's really all the same. The file extension is just there to tell the PC and/or a program using the file what sort of file it is so it can identify it and knows what to do with it. Hell if you wanted to you could probably do the reverse: write a paragraph of text in IDLE's code editor, then save it. Change the extension to .txt and then open it in notepad or whatever. Should be exactly the same. IDLE is also only saving raw text, the difference is only how it displays it to the user: coloring words based on type, catching syntax errors, etc. These are all just how IDLE displays things, they aren't actually part of the file itself.

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!
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!