question about functions

James Stroud jstroud at mbi.ucla.edu
Fri Apr 15 00:58:08 EDT 2005


Just pass a list. E.g.:

# start of ascript

def my_funk(alist):
  print "the first argument: %s" % alist[1]
  print "the second argument: %s" % alist[2]

mylist = ['wuzzup,','g?']

my_funk(mylist)

# end of ascript


Here is the output you expect:

the first argument: wuzzup,
the second argument: g?

On Thursday 14 April 2005 09:44 pm, chris patton wrote:
> Hi everyone.
>
> I have a question about passing arguments to python functions. Is there
> any way to make this job act like Perl?
>
> sub my_funk {
>
> print "the first argument: $_[0]\n";
> print "the second argument: $_[1]\n";  }
>
> In other words, can I call the arguments from a list?

-- 
James Stroud, Ph.D.
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/



More information about the Python-list mailing list