Subroutines

Kalle Svensson kalle at gnupung.net
Fri Oct 13 09:23:52 EDT 2000


On Fri, 13 Oct 2000, j wrote:

> For example how would a perl subroutine below be in python.
> sub myfunc {
> print $_[0];
> }

I'm not very good at perl, but I believe you want to print the first
argument to the function. In this case

def myfunc(arg):
    print arg

would be what you want. I suggest you Read The Fine Manual, starting with
the tutorial, where functions are discussed in sections 4.6 and 4.7.

Python docs - http://www.pythonlabs.com/doc/manuals/python2.0/
Tutorial - http://www.pythonlabs.com/doc/manuals/python2.0/tut/tut.html

Regards,
  Kalle
-- 
Email: kalle at gnupung.net     | You can tune a filesystem, but you
Web: http://www.gnupung.net/ | can't tune a fish. -- man tunefs(8)
Not signed due to logistical difficulties (I'm not at home).
If you doubt the authenticity of this message, please tell me.




More information about the Python-list mailing list