Python syntax

Dave Angel davea at ieee.org
Tue Apr 7 15:41:16 EDT 2009


janus99 wrote:
> well i'm pretty much a newb on python, it's my first comp lang. and
> i've been having some diffuclties, i want to get the hang of it and
> i'm wondering if u could help me understand the syntax structure.
>
> I messed around with my own comp (windos xp) command prompt and i
> currently play a mud, but the python syntax is completly diffrent, i
> was wondering if u could expalin how to syntax goes, i've tried the
> "hello world" but it keep displaying syntax error, i've tried entering
> random commands, e.g find,search, collect,...
>
>
>   
dorzey's suggestion is good, as is the tutorial available with your 
install.  Look for the file  python-docs-pdf-letter.zip, and inside it 
tutorial.pdf
If you didn't download that yet, you can get it from 
http://docs.python.org/download
I prefer the pdf form, but your preferences may be different.   Just try 
to get one that matches the version of the python you downloaded.


The other thing that you need to learn how to do is to cut & paste in 
your command window.  If you drag the mouse around the command window it 
should highlight some text.  Then you right click to put that on the 
clipboard.  Now you can go to some other program (like your mail 
program) and Ctrl-V to paste it.  If that mode isn't enabled on your 
command windows, fix it, although you can manually use the system menu 
to accomplish the same thing (which I do when I'm using someone else's 
machine).

When you ask for help here, please be specific.  What did you try, and 
exactly what was the error.  For all we know, you weren't even 
successful in getting the python.exe program to run at all.  So it could 
be a path problem, not a language syntax problem.  Here's a sample 
session.  If you can't get this far, show us exactly what you did get.

E:\>c:\ProgFiles\Python26\python.exe
Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC v.1500 32 bit 
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> "hello world"
'hello world'
 >>> 3*12
36
 >>> import sys
 >>> sys.exit(0)

E:\>









More information about the Python-list mailing list