PYTHON require

is this article helpful?
|
Python replacement for PHP's require [ edit | history ]
execfile('myfile.py')


You can also use import myfile only for first time and reload(myfile) for successive call as described in python documentation.


Example:

myfile.py
def foo(x,y):
	return x+y*4

a = 3
print 'here we go'


Console:
>>> execfile('myfile.py')
here we go
>>> a
3
>>> foo(4,5)
24

PHP require

PHP original manual for require [ show | php.net ]

require()

require() is identical to include() except upon failure it will produce a fatal E_ERROR level error. In other words, it will halt the script whereas include() only emits a warning (E_WARNING) which allows the script to continue.

See the include() documentation for how this works.