arguments from the prompt
joe at localhost.localdomain
joe at localhost.localdomain
Tue Feb 8 07:07:52 EST 2000
On Mon, 07 Feb 2000 18:33:51 -0500, Thomas A. Bryan <tbryan at python.net> wrote:
>joe at localhost.localdomain wrote:
>
>> it says NameError: sys
>
>> #!/usr/bin/python
>> from sys import argv
>>
>> a=sys.argv[1]
>
>
>When you use 'from sys import argv', the symbol 'argv' is now
>available to your code directly. You no longer have to reference
>the module name. In fact, sys is *not* available after you run
>'from sys import argv' just like it isn't available after you run
>'from sys import *'. If you simply write 'import sys', then the
>symbol 'sys' is avialable, but 'argv' is only accessible through sys.
>
>So, either write
>
>from sys import argv
>a = argv[1]
>
>or
>
>import sys
>a = sys.argv[1]
>
thanks, btw is there a FAQ?
More information about the Python-list
mailing list