problem at installing phyton on windows

Paul Boddie paul at boddie.org.uk
Sun Mar 25 18:20:01 EDT 2007


gslm wrote:
> Please, can you read again?
> Yes, I understand that in phyton interpreter, i can't call phyton
> command.Thanks...
>
> But how can i run '.py' files from this command line?I wanted to use
> the phyton command for this.

Once you are in the Python interpreter you can run Python files, but
the best way to run files is one of the following:

 * From the command prompt (DOS prompt); type something like this:

    python file.py

 * In the file manager (Windows Explorer, not Internet Explorer), open/
run file.py.

If you *really* want to run files in the interpreter, you can do
something like this:

    execfile("file.py")

> When i click a py extended file, for example calendar.py in lib
> directory, file opens, then suddenly close,except graphical ones.Why?
> How can i see the results?

For things that don't open windows you really need to run them from
the command prompt.

> And where can i learn which library must i import for whic class?

Look at the library reference: each of the listed libraries are named,
and for the calendar module you'd put this in your program (or type it
at the Python prompt):

    import calendar

Note that in Python programs or at the Python prompt you do not refer
to it as calendar.py or C:\Python24\Lib\calendar.py (or wherever it
lives): Python knows where to look and knows to add the .py on the end
of the file.

Note also that this doesn't run the calendar module, so it isn't quite
the same as running the calendar.py file as described above.

> Sorry, i ask much:(But after learning these starting knowledeges, i
> read tutorials, manuals etc.
> But now i haven't found my answers yet.

I hope this helps a little.

Paul




More information about the Python-list mailing list