3

I have installed Ubuntu and it came with Python 2.7.3 but I can't save any of my programs. I tried going to File, looking for a Save option, but it is not present. What should I do?

  • 5
    What is the editor you use for writing your python programs? How is this question related to Windows 7 (you tagged it)? – Takkat Mar 20 '13 at 11:43
  • 4
    The answers make it clear what the OP's situation is and what is being asked--the OP was trying to use the Python interpeter itself to compose reusable scripts. We should reopen this--we can all tell what's being asked here now. (In case anyone is confused about the part with the File menu existing but not having a Save option--that's describing the File menu in GNOME Terminal, where python likely runs.) – Eliah Kagan Mar 21 '13 at 09:59
  • 1
    It maybe a good idea to wait for OP to clarify rather than speculate on what the question means based on the answers. –  Mar 21 '13 at 11:53
  • @vasa1 I think the question is clear enough to reopen it. – Seth Mar 21 '13 at 13:57
  • @vasa1 Has anyone come up with any other likely interpretation of this? Alternatively, would this question not be helpful to other users (even if the OP never returns)? – Eliah Kagan Mar 21 '13 at 14:30
  • Agreed with Eliah. From the question (to me! since I also use the interpreter) it was clear what was asked. But she aint comming back :( – Rinzwind Mar 21 '13 at 17:59

2 Answers2

8

The command line interpreter for Python is not an editor and does not have a save option. This is just something for testing your commands.

You need something like gedit (or another editor) to type your commands. Those editors all have save option.

Rinzwind
  • 299,756
4

If you want to program with Python on Ubuntu, I suggest you use IDLE. IDLE was built entirely using Python and tK (a window module for python) and it works fine for anything I have ever done.
It gives you syntax highlighting and debugging features, very handy for tracking down bugs and the like.

Gedit also works, and it has several languages that it can syntax highlight, but it doesn't have the debugging features (at least that I have seen.)

Another one you could look into is Stani's Python Editor, another IDE developed by a user.

Like @Rinzwind said, the python command line doesn't provide an option for saving your source files, it is just a way to test out commands and ideas without actually having to write a full program to do it.


EDIT:

Another one I found very useful was Geany.

I don't remember if I had to install it or not (probably did, simple search in the Software Center should bring it up). It gives code highlighting, auto-indentation, the ability to increase & decrease the indents on chunks of code, the ability to comment out chunks of code, and run the code directly from the IDE. You can also quickly swap between running it with python (default) and python3 or another.