Feb-23-2018, 11:55 PM
(Feb-23-2018, 11:07 PM)Python_n00b_06 Wrote: So basically "import" for Python is like "#include" for C/C++?The general idea is similar similar,that want to use code written somewhere else in your program.
The underlying mechanism has several differences as C++ is a compiled language and Python is a interpreted language.
Example with
#include <iostream>
imports the methods related to input and output.Python has these already build in,like eg
print
, write
ect...Python:
def foo(): print("Hello world!")C++:
#include <iostream> using namespace std; void foo(){ cout << "hello world!" << endl; }