2023年1月8日
摘要: # 引用PTL图片 from PIL import Image # 打开图片 image=Image.open('./image/1.JPG') # 打印图片 print(image) # 显示图片image.show() # 打印图片的尺寸、模式、具体信息、格式化信息 print(image.si 阅读全文
posted @ 2023-01-08 20:21 至清无物 阅读(195) 评论(0) 推荐(0) 编辑
摘要: # 乘法口诀 for x in range(1,10): for y in range(1,x+1): print(f'{y}x{x}={x*y}', end='\t') print() print('\n') # 加法口诀 for x in range(1,10): for y in range( 阅读全文
posted @ 2023-01-08 20:17 至清无物 阅读(559) 评论(0) 推荐(0) 编辑
摘要: #求随机三个数是水仙花数 num=random.randint(100,999) hundred=num // 100 decade=num % 100 // 10 ones=num % 10 if hundred ** 3 +decade ** 3 +ones ** 3 == num: print 阅读全文
posted @ 2023-01-08 20:12 至清无物 阅读(100) 评论(0) 推荐(0) 编辑
摘要: #求闰年和平年 year=random.randint(1900,2023) if (year % 4 ==0 and year % 100 !=0) or (year % 400 ==0): print(f'{year}年是百年一遇的闰年,顺顺利利') else: print(f'现在是{year 阅读全文
posted @ 2023-01-08 20:05 至清无物 阅读(189) 评论(0) 推荐(0) 编辑
摘要: import random #求随机能被3和5同时整除的数 num=random.randint(1,1000) if num % 3==0 and num % 5 ==0: print(f'数字{num}可以被3和5整除') elif num % 3 ==0: print(f'数字{num}可以被 阅读全文
posted @ 2023-01-08 20:04 至清无物 阅读(81) 评论(0) 推荐(0) 编辑
摘要: name=str(input('请输入姓名:')) age=int(input('请输入真实年龄:')) if age >= 18 : print(f'恭喜{name}可以在网上冲浪了。') else: print('小小年纪不学好,赶紧回家写作业去!') money=float(input('嘴巴 阅读全文
posted @ 2023-01-08 19:55 至清无物 阅读(34) 评论(0) 推荐(0) 编辑
摘要: #导入工具 import turtle #奥运五环 turtle.screensize(800,800) turtle.pensize(10) #中间黑色的圆 turtle.pencolor('black') turtle.circle(100) #左边蓝色的圆 turtle.penup() tur 阅读全文
posted @ 2023-01-08 19:19 至清无物 阅读(272) 评论(0) 推荐(0) 编辑
摘要: #导入工具 # import turtle #定义一个画布尺寸的两种方式 turtle.screensize(100,100) turtle.setup(800,600,700,200) #定义画笔 turtle.shape('turtle') #定义画笔颜色 turtle.pencolor('bl 阅读全文
posted @ 2023-01-08 19:12 至清无物 阅读(1666) 评论(0) 推荐(0) 编辑
摘要: time=15678 hour=time//3600 minute=time%3600//60 second=time%60 print(hour,'时',minute,'分',second,'秒') 4 时 21 分 18 秒 阅读全文
posted @ 2023-01-08 19:01 至清无物 阅读(109) 评论(0) 推荐(0) 编辑
摘要: a=10 b=20 a=a^b b=a^b a=a^b print(a,b) 返回 20 10 阅读全文
posted @ 2023-01-08 19:01 至清无物 阅读(72) 评论(0) 推荐(0) 编辑
摘要: print(ord('y'),',',ord('a')) 121 , 97 阅读全文
posted @ 2023-01-08 18:59 至清无物 阅读(16) 评论(0) 推荐(0) 编辑
摘要: # 算数运算符的区别 # 数值+布尔真为1假为0 print(1+True) # 在字符串里面+作为连接符使用 print('你'+'好'+'!') # 在字符串里面用乘号,输入该字符串三次 print('您好\n'*3) # 幂运算为前一个数的后一个数次方 print(2**3) # 除 # pr 阅读全文
posted @ 2023-01-08 18:43 至清无物 阅读(13) 评论(0) 推荐(0) 编辑
摘要: print(type(1)) 返回 int print(type('您好')) 返回 str 字符串 print(type(0>1)) 返回 bool 布尔类型 print(type(3.145)) 返回 float 浮点类型 print(type(1))# 返回 int print(type('您 阅读全文
posted @ 2023-01-08 18:40 至清无物 阅读(148) 评论(0) 推荐(0) 编辑
摘要: # 图片裁剪,需要设置边缘间距【left,upper,right,lower】 image_5=image.crop(box=(1000,1000,1000,1000)) image_5.show() 出现错误 SystemError: tile cannot extend outside imag 阅读全文
posted @ 2023-01-08 11:01 至清无物 阅读(700) 评论(0) 推荐(0) 编辑
摘要: 运行如下代码:突然出现错误。 from PIL import Image image=Image.open('./image/3.JPG') print(image) image_1=image.resize((1000,1000)) image_2=image.resize((image.size 阅读全文
posted @ 2023-01-08 10:08 至清无物 阅读(1242) 评论(0) 推荐(0) 编辑