Python windows interactive.

Paul McGuire ptmcg at austin.rr._bogus_.com
Mon Oct 30 22:20:17 CET 2006


"notejam" <notejam at sbcglobal.net> wrote in message 
news:1162241672.682830.189240 at b28g2000cwb.googlegroups.com...
>I am trying to get started with a interactive version of Python for
> windows and need some help.
> I have played with the tutorial, and now want to write a program.
>
> In basic language, I could write something like
> 10 print "hello"
> 20 print "Jim"
>
> and if I run it I would get
> hello
> Jim
>
> How do I do sometihing simple like that in python?
> How do I enter line numbers, or if none, what do I do.
> Can the interpreter load a text file with my program in it?
> How do I list a program or the parts of a program I am interested in
> looking at?
>
> How do I run a python program?
>
Hmmm, exactly how much have you "played with the tutorial"?  I think if you 
go back and play some more, you will answer many of these questions for 
yourself.

In fact, you should find Python to be quite friendly to your past 
experience.  For example, if you take your basic language example, remove 
the line numbers (Python doesn't use them, and many modern Basics don't 
either), and just enter the same print statements at the Python command 
line, you should get the exact same output.

Python editing doesn't require a specialized development environment (the 
way VisualBasic does, for example).  Python programs are simply text files, 
usually saved with a .py extension, that you create, view, print, list, etc. 
using any plain text editor.  (Note: Windows WordPad does not fall in this 
category - like a slimmed-down version of Word, WordPad inserts many special 
binary characters for text formatting, which is not at all Python-friendly.)

If you use a simple text editor like notepad, enter those same two lines 
above (remember, without the line numbers) in a text file, name it 
"HelloJimThisIsYourFirstPythonProgram.py", then open a console window, set 
your working directory to the same directory where you saved 
HelloJimThisIsYourFirstPythonProgram.py, and enter at the command line: 
"python HelloJimThisIsYourFirstPythonProgram.py" (leave off the quotes, they 
are just there in this message to show you what to type), you should get the 
same output.  And voila! you have run your Python program.

I've left out a lot, because there is quite a bit of meat in the tutorials 
already available.  Also, there are more tutorials than just the official 
one, google about a bit and you should find quite a bit of entry-level 
material.

Lastly, before posting again, please review the Python FAQ's at 
http://www.python.org/doc/faq/.  Don't be another one to exclaim "Shoot! I 
wish I'd checked the FAQ's before posting that newbie question that everyone 
is tired of hearing again and again!"

Best of luck to you in your new Python adventure!
-- Paul 





More information about the Python-list mailing list