[Tutor] question

Alan Gauld alan.gauld at blueyonder.co.uk
Fri Aug 6 21:20:26 CEST 2004


> I need help with programming I'm new at it so my questions are going
to be
> basic

That's OK, it's what we are here for! :-)

> well anyway how would I get a string to display on start up of a
> module/program? What command?

print "hello world"

will print

hello world

on your console window.

Put that in a file by itself and them import the file and the
message will print.

Thus create a file called mymessage.py containing the single
print statement above. Save it in the sitepackages folder in
your python installation(so that it can be found by python)
OR
create a new folder and add it to your PYTHONPATH envoironment
variable
(How to do that depends on your OS)

Now open your python prompt(or IDLE) and when you get the chevrons,
>>>

type

>>> import mymessage

Note no .py...

And hopefully the message

hello world

will appear.

You will find lots more in the nonprogrammers tutorials on the
Python web site, one of which is mine:

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld/tutor2/



More information about the Tutor mailing list