This commit is contained in:
2025-08-23 22:38:20 +08:00
parent 8041fa1438
commit 12de39c6fb
4 changed files with 64 additions and 0 deletions

14
day8/传参.py Normal file
View File

@ -0,0 +1,14 @@
class People():
def __init__(self,name,age):
self.name = name
self.age = age
def getname(self):
return self.name
def getage(self):
return self.age
def eat(self,food):
print(self.name+'吃掉了'+food)
r = People('僵尸',213)
#print(r.name)
print(r.getname(),r.age)
r.eat('你的大脑')

16
day8/订单号.py Normal file
View File

@ -0,0 +1,16 @@
import datetime
class Random:
def __init__(self):
self.cpu_id = 123
self.os_id = 890
def get(self):
timestamp = int(datetime.datetime.now().timestamp() * 1000000)
final = timestamp * 1000000 + self.cpu_id * 1000 + self.os_id
return final
r = Random()
print(r.get())