Calling Values

Nobody nobody at nowhere.com
Fri Aug 3 08:44:31 EDT 2012


On Fri, 03 Aug 2012 04:49:46 -0700, Subhabrata wrote:

> I am trying to call the values of one function in the another function
> in the following way:
> def func1():
> 	num1=10
> 	num2=20
> 	print "The Second Number is:",num2
> 	return
> 
> def func2():
> 	num3=num1+num2
> 	num4=num3+num1

A function's local variables only exist while that function is being
executed[1]. It's meaningless to try to access them from outside the
function.

[1] There is an exception (closures), but it doesn't have any bearing on
this particular problem.




More information about the Python-list mailing list