摘要:
class Animal: def __init__(self,name,aggressivity,life_value): self.name = name self.aggressivity = aggressivity self.life_value = life_value #狗 class 阅读全文
摘要:
面向对象的命名空间 组合 组合的例题 #狗 # class Dog: # 定义一个狗类 # def __init__(self, name, breed, aggressivity, life_value): # self.name = name # 每一只狗都有自己的昵称; # self.bree 阅读全文
摘要:
# 人类: # 属性:life_value,aggr,anme,job # 方法:attack class Person: def __init__(self,life_value,aggr,name,job): self.life = life_value self.aggressive = ag 阅读全文
摘要:
模块 阅读全文
摘要:
try: a except NameError: print('NameError') print(123) 阅读全文
摘要:
# f = open('json_file','w') # json.dump({'k':(1,2,3)},f) # f.close() # with open('json_file') as f: # ret = json.load(f) # print(ret,type(ret)) # ret 阅读全文
摘要:
import time # ret = time.time() #时间戳,时间戳表示的是从1970年1月1日00:00:00开始按秒计算的偏移量 # print(ret) #1510647685.4264479 # print(type(ret)) # 格式化的时间字符串strftime # ret 阅读全文