Python learning


{.headerlink}Python learning {#Python-learning}

a file containing a set of functions you want to include in your
application .

to create a module just save the code you want in a file with the file
extension .py

save this code in a file named mymodule.py

def hello (name):
print(“hello ,” + name)

now we can use the module we just created by using the **import **
statement:

import the module named mymodule , and call the hello
function
import mymodule

mymodule.hello(“malu”)

note: when using a function from a module, use the syntax:

module_name.function_name

the module can contain functions, as already described ,but also
variables of all types

the module can contain functions, as already described,but also
variables of all types
the module can contain function


Author: malu
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint policy. If reproduced, please indicate source malu !
赏
  TOC