Module

Total Post:113

Points:791
Python 
 231  View(s)
Ratings:
Rate this:

What is the Python module ? How to use this ?

  1. Post:140

    Points:984
    Re: Module

    Consider a module to be the same as a code library. A file containing a set of functions you want to include in your application. 

    Create a Module : 

    def greeting(mindstick): 
      print("Hello, " + mindstick)

    import mymodule :

    mymodule.greeting("Mindstick") 

    Variables in Module : 

    The module having functions as already described,but also variables of all types(arrays, dictionaries, objects etc): 

    person1 = { 
      "name": "Prakash",
      "age": 19,
      "country": "India"
    }

    Built-in Modules : 

    built-in modules in Python,which you can import whenever. 

    import platform 
    x = platform.system()
    print(x)

    Import From Module :

    You can choose to import only parts from a module,by using the from keyword. one function and one dictionary: 

    def greeting(mindstick): 
      print("Hello, " + mindstick)
    person1 = {
      "name": "praksh",
      "age": 19,
      "country": "India"
    }

      Modified On Jul-06-2018 01:31:41 AM

Answer