GoConqr has a new look! Let us know what you think.

Mind map

Python : Modules and Packages

Briache Issam English

Python : Modules and Packages

Map content

Python : Modules and Packages

  1. Python Modules

    • The Modules in Python ar just some fils with .py Extension
      • In these fils we can write any Python code and excute it from the main Python file
        • To do that we use """import ModulsName""" and ModulsName..functionsName()
          • If we want to call these functions whithout using the ModulsName we write: from ModulsName import FunctionsName
            • Look at this Explaining Example
  2. Python Packages

    • We use Packages to group or combine different Modules into one file
      • Like the Modules ,Packages containe files with some code to execute in the main Python file
        • it's necessary to add a file named""__init__ .py"",this is the initialization Python file, it allows us to import the whole folder
          • also in packages, we use """from Package'sName import Module'sName""" and Modul'sName..Function'sName()
            • Look at this explaining Example
  3. Some Built-in Modules in Python

    • Random Modules
      • Random() : Gives a random number between 0.0 and 1.0
      • Randint("Start number","End number") : Gives a random integer number in a given range
      • randrange("Start number","End number","Step") : Gives a random number in a range using a specific number of steps
      • Uniform("Start float number","End Float number") : Gives a random float number in a range
      • shuffle(Sequence'sName) : Reorder the list items arbitrarly
      • choice(Sequence'sName) : choice a random item from a list or a tuple or a set
      • sample(Sequece'sName , number_of_items) : choice a number of items randomly
    • Date and Time Modules
      • datetime..now() : Gives the current date with the hour, nminutes and seconds
      • date..today() : Gives the current date with the year, month, and day
      • We can use the atributes : year, month, day ,hour,minute,second to print the year,month,day,hour,monute,or second
      • if we want to print a specific date we use datetime(year,month,day,hour,minute,second)
      • use total_seconds to know how many seconds in a date
    • Look at this Explaining Exampe
    • Look at this Explainong Example

Images and files in the map

  • Python : Modules and Packages
  • Python : Modules and Packages
  • Python : Modules and Packages
  • Python : Modules and Packages

Information

Description
Mind Map on Python : Modules and Packages, created by Briache Issam on 20/08/2021.
Created by
Briache Issam
Views
1
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?