from sklearn.ensemble import RandomForestClassifier
print(RandomForestClassifier())


import file2
print(file2.a)

file2.printjoke("This is me")
  
import sys
print(sys.path)

# importing file 2 ....
# from file2 import a     # ----> Bad practice
# print(a)

# also

import file2     # ---> Good practice
print(file2.a)
file2.printjoke("This is you")
Exemple #3
0
import sklearn as sk
# print(sk.__version__)
import sys
# print(sys.path)
import file2
print(file2.a)
file2.printjoke(" Hi ")
#It can be used as this format
# from file2 import a
# print(a)
'''
import sklearn as sk
# Note: import module as module_name does not rename the module originally but only for a specific program where it is imported using this sort of keyword.
'''
Disadvantages:
One of the major disadvantages of the flexibility provided by a python in the  of modules is that they can be easily modified and overridden. 
Along with disrupting the functionality of the program, case
it also poses a major security risk.
'''
# to get version
# 1st method
import sklearn
print(sklearn.__version__)  #it takes time
#2nd method
import sklearn as sk
print(sk.__version__)
#donot make a file with the name of module

# if make a file with the name of module then it simply uses that file
# we have made file2 and imported it and access it
# 1st method
import file2  #mostly prefer method
print(file2.a)
# 2nd method
from file2 import a
print(a)
# we have stored the function (printjoke) in file2 and we can import
file2.printjoke(
    "hahhahaha")  #this helps to print this is a function is a joke hahahahah
#variables which are stored in program are int,float
import pandas as pd
import file2
print(pd.__version__)
print(file2.a)
print(file2.printjoke("file 1"))
Exemple #6
0
import file2
print(file2.a)
file2.printjoke("ankur")