创建类并且传参输出
class tax():
def init(self,a,b):
self.a=a
self.b=b
print(“you are %s and you like %s” %(a,b))
def tat(self): print("good")
#from test1 import tax(导入创建的类)
t1=tax(‘baobao’,‘baozi’)
t1.tat()
t2=tax(‘jiaojiao’,‘jiaozi’)
t2.tat()
t3=tax(‘bobo’,‘nuaizi’)
t3.tat()
导入
导入时间模块
import time
print(time.ctime())
导入随机数
import random
num=random.randint(10,50)
print(num)
from导入
from time import sleep
t4=tax(‘mianmian’,‘ruznzi’)
t4.tat()