摘要: ###简单的实例 阅读全文
posted @ 2018-11-05 19:47 知冬 阅读(1804) 评论(0) 推荐(0) 编辑
摘要: __author__ = '12711'#-*- coding:utf-8 -*-class Dog(object): def __init__(self,name,age): self.name=name self.age=age def Yell(self,cry): self.cry=cry 阅读全文
posted @ 2018-10-24 16:45 知冬 阅读(130) 评论(0) 推荐(0) 编辑
摘要: __author__ = '12711'#-*- coding:utf-8 -*-'''让用户输入数字相加,若用户输入有误,返回错误while True: num1 = input('num1:') num2 = input('num2:') try: num1 = int(num1) num2 = 阅读全文
posted @ 2018-10-24 16:42 知冬 阅读(164) 评论(0) 推荐(0) 编辑
摘要: __author__ = '12711'#-*- coding:utf-8 -*-# class Animal(object):# name='xxx'# def __init__(self,name,age):# self.name=name# self.age=age## def eat(sel 阅读全文
posted @ 2018-10-18 20:25 知冬 阅读(192) 评论(0) 推荐(0) 编辑
摘要: __author__ = '12711'#-*- coding:utf-8 -*-import randomx=random.random()#生成一个【0-1)的随机浮点数x=random.uniform(0,10)#生成一个指定范围的随机浮点数范围为【0-10】x=random.randrang 阅读全文
posted @ 2018-10-09 21:21 知冬 阅读(138) 评论(0) 推荐(0) 编辑
摘要: __author__ = '12711'#-*- coding:utf-8 -*-import time# time.time()#返回当前时间# x=time.altzone#返回与utc(国际标准时间)时间的时间差,以秒计算\# x=time.asctime()#返回时间格式"Mon Oct 8 阅读全文
posted @ 2018-10-08 21:05 知冬 阅读(719) 评论(0) 推荐(1) 编辑
摘要: __author__ = '12711'#-*- coding:utf-8 -*-'''g=(i*2 for i in range(10))print(g)print(next(g))next(g)print( g.__next__())# g.__next__()# for i in g:# pr 阅读全文
posted @ 2018-09-28 17:11 知冬 阅读(94) 评论(0) 推荐(0) 编辑
摘要: 装饰器定义及功能: 1,不改变被装饰程序的源代码和调用方式 2.为一个应用增加新功能 阅读全文
posted @ 2018-09-28 10:45 知冬 阅读(101) 评论(0) 推荐(0) 编辑
摘要: __author__ = '12711'#-*- coding:utf-8 -*-f=open("F",'r')f_n=open("N",'w')for i in f: if "我爱你" in i : i=i.replace("我爱你","我恨你") f_n.write(i)f.close()f_n 阅读全文
posted @ 2018-09-21 19:13 知冬 阅读(78) 评论(0) 推荐(0) 编辑
摘要: __author__ = '12711'#-*- coding:utf-8 -*-f=open("F",'r')#读文件#f=open("F",'w')#写文件f=open("F",'r+')#读写#f=open("F",'w+')#写读#f=open("F",'rb')#二进制文件#f=open( 阅读全文
posted @ 2018-09-21 19:12 知冬 阅读(64) 评论(0) 推荐(0) 编辑