I am coming to python from ruby. What is the equivalent statement of require (Ruby) in Python?
+3
A:
The import
statement.
Maybe it's advisable you follow a Python tutorial where much of the basics are explained
Ikke
2010-09-21 12:28:43
There is a difference between import(Python) and require(Ruby). If i require in ruby (only require statement), File can be executed whereas having only import statement does not. For e.g. Suppose i have program(hello.rb) in ruby which has a line print "hello". I can execute this file by just doing this -> require "hello"
abhishek
2010-09-21 12:32:23
@abhishek, this is completely wrong. A python module __is__ executed when it is imported! How else would the classes and functions which it contains be defined?
aaronasterling
2010-09-21 12:48:33
@ AaronMcSmooth -- you are right.
abhishek
2010-09-21 13:10:51