How to import new Modules?

Alex Martelli aleax at aleax.it
Wed Jan 30 17:49:23 CET 2002


"Daniel Lewendel" <leva4ever at t-online.de> wrote in message
news:a397o5$vb9$02$1 at news.t-online.com...
> Hi there,
>
> I want to import the SYS Module to use the ARGV function.
> How to do this? The Documentation is a little bit complex for a German
Human
> like me...   :)

Put in your program the line:

import sys

as I have written it: lowercase, not uppercase (capital letters) as
you used.  Now, you can access sys.argv, which however is a list of
strings, not a function.

Try the following two-line programs, call it for example myarg.py:

import sys
print sys.argv

have fun calling it with different arguments and see what comes out.

By the way, I think there are Python books in German.


> The Background is that I have changed School and now i have to learn
Python
> by my self. I use it on an Windows XP System and in school it works on an
> Unix system (SUSE Linux i guess). Can I use the Programms worked out at
home
> at school without any problems?

Yes.  Remember that SUSE Linux and other Unix-like systems are case
sensitive, so take care about lowercase versus uppercase.  Also check
what Python versions you have installed at school, using for example
the following command at the shell prompt:

    python -V

and make sure you install the same version at home to avoid any risk
of confusion, since there are slight differences between versions.


Alex






More information about the Python-list mailing list