views:

100

answers:

1

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
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
@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
@ AaronMcSmooth -- you are right.
abhishek