Autumn, Here's a basic script, if you save this in a file called hello.py and type 'python hello.py' at the prompt, or as others are saying using the python launcher, you should get some output. hth, john
SCRIPT (include lines below here): #!/usr/bin/env python import os user = os.environ.get('USER') print "Hello %s!" % (user) ==== NOW SOME COMMENTS ==== the first line is somewhat 'unix or linux' dependent, but it tells your 'shell' to call the file using python the next line "import os" is a python import statement, telling python to import the os module the next line "user os.environ.get('USER')" is call a method (get) from the environ class of the os module and returns the name of the logged in user to the variable 'user' the next line is doing a few things. First it is calling the built in function 'print' to print a string "Hello %s!". However, the "%s" does something fancy. This is string substitution, so by having the variable 'user' after the second '%' sign, it replaces "%s" with that variable. Don't worry, it will come fast! Have fun with it!! On Wed, Oct 20, 2010 at 6:13 PM, Autumn Cutter <autumn...@gmail.com> wrote: > I just started learning Python last night and I'm a little stuck on how to > write a Python script. > I'm using Python 2.5.0 on a Mac OS X 10.6.4. I've tried using programs like > Idle, Applescript and Textmate but I'm still unable to write a script and run > it successfully. I'm wondering if I'm using the write program or if I > understand correctly how to write and run scripts. Help! :( > > _______________________________________________ > Tutor maillist - tu...@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > -- Configuration `````````````````````````` Plone 2.5.3-final, CMF-1.6.4, Zope (Zope 2.9.7-final, python 2.4.4, linux2), Python 2.6 PIL 1.1.6 Mailman 2.1.9 Postfix 2.4.5 Procmail v3.22 2001/09/10 _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor