PythonWin working, but stuck on first script :-(

Matthias Huening matthias.huening at univie.ac.at
Fri Mar 3 07:52:26 EST 2000


Adolfo Aguirre wrote...
>Help :-(            This code:
>
>def hello(msg):
>     print "Hello,  " + msg
>
>def maiin():
>     import sys
>     print "Script name is", Sys.argv[0]
> if len(sys.argv)>=2:
>      hello(sys.argv[1])
>
> else:
>      hello("Please say something next time")
>
> if __name__=='__main__':
>      main()
>
>

There are lots of typos in your code.
The following should work just fine:

######

def hello(msg):
    print "Hello,  " + msg

def main():
    import sys
    print "Script name is", sys.argv[0]
    if len(sys.argv)>=2:
        hello(sys.argv[1])
    else:
        hello("Please say something next time")

if __name__=='__main__':
     main()

######

Matthias

- - - - -
matthias.huening at univie.ac.at
http://www.ned.univie.ac.at/






More information about the Python-list mailing list