passing what a function returns to another function

Miki Tebeka miki.tebeka at zoran.com
Sun Feb 8 10:02:42 CET 2004


Hello Bart,

> I have 2 functions among others. One gets a URL and returns its, For
> example, it returns 'http://127.0.0.1' How can I pass this to another
> function? I've never worked with code that has lots of functions before.
You can either use a varible to store the 1'st result and pass it to
the 2'nd function of call the 1'st function directly as a parameter:

>>> def double(x):
	return x * 2

>>> def triple(x):
	return x * 3
>>> a = double(2)
>>> triple(a)
12
>>> triple(double(2))
12

HTH.
Miki



More information about the Python-list mailing list