摘要: from turtle import * def square(size=50,rgb='gold'): pencolor(rgb) for i in range(4): fd(size) left(90) setup(800,600) speed(0) n=10 for i in range(n) 阅读全文
posted @ 2022-06-13 22:55 李禹灼 阅读(20) 评论(2) 推荐(0) 编辑
摘要: class User(): count = 0 def __init__(self, username='guest', password='111111', status='1'): self.username = username self.password = password self.st 阅读全文
posted @ 2022-06-07 23:21 李禹灼 阅读(16) 评论(3) 推荐(0) 编辑
摘要: f1=open('D:\\data3_id.txt','r') list1,list3=[],[] for i in f1.readlines(): list1.append(i.strip().split(',')) def is_valid(x): if len(x)==18: for i in 阅读全文
posted @ 2022-05-24 20:15 李禹灼 阅读(7) 评论(3) 推荐(0) 编辑
摘要: task3. mport math f1=open('D:\\data3.txt','r') list1,list2=[],[] for line in f1.readlines(): line=line.strip('\n') list1.append(line) print(list1[0]) 阅读全文
posted @ 2022-05-15 16:47 李禹灼 阅读(14) 评论(3) 推荐(0) 编辑
摘要: print(sum) sum = 42 print(sum) def inc(n): sum = n + 1 print(sum) return sum sum = inc(7) + inc(7) print(sum) 不是: 第一个sum作用的是一开始定义的42; 第二个sum作用的是调用的n+1 阅读全文
posted @ 2022-05-10 23:05 李禹灼 阅读(36) 评论(2) 推荐(0) 编辑
摘要: import random print('用列表存储随机整数: ') ls=[random.randint(1,100) for i in range(5)] print(ls) print('\n用集合存储随机整数: ') s1={random.randint(1,100) for i in ra 阅读全文
posted @ 2022-04-23 16:57 李禹灼 阅读(36) 评论(3) 推荐(0) 编辑
摘要: x=list(range(10)) print('整数输出1:',end='') for i in x: print(i,end=' ') print('\n整数输出2:',end='') for i in x: print(f'{i:02d}',end='-') print('\n整数输出3:', 阅读全文
posted @ 2022-04-11 23:15 李禹灼 阅读(23) 评论(3) 推荐(0) 编辑
摘要: 1 print('hey,u') 2 3 print('hey','u') 4 x,y,z=1,2,3 5 print(x,y,z) 6 7 print('x=%d,y=%d,z=%d'%(x,y,z)) 8 print('x={},y={},z={}'.format(x,y,z)) 9 print 阅读全文
posted @ 2022-03-29 01:12 李禹灼 阅读(27) 评论(3) 推荐(0) 编辑