Wednesday, October 28, 2020

import * working method

 

create a file on student.py

========================


class Person:

  def __init__(self, name, age):

    self.name = name

    self.age = age



def anil_test(i):

    print("this is working"+i)


create another file test.py

======================

#from student import anil_test,Person

from student import *



anil_test("anil")

p1 = Person("John", 36)


print(p1.name)

print(p1.age)


No comments:

Post a Comment

python class topic video