摘要: class diGua(): def __init__(self): self.cooking="生" self.time=0 self.addItem=[] def __str__(self): return "%d分钟地瓜已经%s,添加了:%s"%(self.time,self.cooking, 阅读全文
posted @ 2020-05-24 09:33 名狐1993 阅读(204) 评论(0) 推荐(0)
摘要: class Sond(): def __sond(self):#私有方法 print(" 正在发短信 ") def sond(self,money):#公有方法 if money>0: self.__sond() else: print("你的余额不足,请充值")em=Sond()em.sond(- 阅读全文
posted @ 2020-05-24 09:31 名狐1993 阅读(204) 评论(0) 推荐(0)
摘要: class diGuo: def __init__(self):#初始化类 self.cooking="生" self.time=0 def __str__(self):#描述对象 return "%d分钟地瓜已经%s"%(self.time,self.cooking) def cook(self, 阅读全文
posted @ 2020-05-24 09:29 名狐1993 阅读(373) 评论(0) 推荐(0)
摘要: #coding=utf-8#Version:python3.7.4#Tools:Pycharm 2018.3.5class House(): def __init__(self,newInfo,newArea,newAddr): self.info=newInfo self.area=newArea 阅读全文
posted @ 2020-05-24 09:28 名狐1993 阅读(351) 评论(0) 推荐(0)
摘要: #批量修改文件import osf=input("请输入文件夹")#请输入文件夹files=os.listdir(f)#获取文件夹里面文件os.chdir(f)#当地工作目录for i in files: os.rename(i,"[新]"+i)exit() 阅读全文
posted @ 2020-04-27 15:35 名狐1993 阅读(231) 评论(0) 推荐(0)
摘要: # 打印出5000以内的带5的数字for i in range(1,5000): ge = i % 10 # 个位 shi = i // 10 % 10 # 十位 bai = i // 100 % 10 # 百位 qian = i / 1000 # 千位 if ge==5 or shi==5 or 阅读全文
posted @ 2020-04-27 15:14 名狐1993 阅读(629) 评论(0) 推荐(0)
摘要: #用户在键盘上输入一个自然数n,然后在区间[1, 5n]上随机生成n个不重复的自然数,输出这些自然数,# 然后继续编写代码对这些自然数进行处理,只保留所有偶数,并输出这些偶数import randomn=int(input("请输入整数"))shu=set()i=0while True: num=r 阅读全文
posted @ 2020-03-21 11:13 名狐1993 阅读(5267) 评论(1) 推荐(0)
摘要: #倒着输入字符串zf=str(input("请输入字符串"))cd=len(zf)for i in range(cd): print(zf[cd-i-1],end="") 阅读全文
posted @ 2020-03-20 17:45 名狐1993 阅读(510) 评论(0) 推荐(0)
摘要: #去重a=[1,2,3,4,5,6,1,2,4]b=[]for i in a: if i not in b:#判断b在不在a里面 b.append(i)print(b) 阅读全文
posted @ 2020-03-11 23:00 名狐1993 阅读(177) 评论(0) 推荐(0)
摘要: #第一次未签到的[2,4,5,8,9,]#第二次未签到的[3,5,6,7,1,11,]num1=[2,4,5,8,9]num2=[3,5,6,7,8,11,12]kong=[]#两次都没有到for i in range(len(num2)): for j in range(len(num1)): i 阅读全文
posted @ 2020-03-10 15:41 名狐1993 阅读(259) 评论(0) 推荐(0)