摘要: 1 from turtle import* 2 def square(size=50,rgb='orange'): 3 pencolor(rgb) 4 for i in range(4): 5 fd(size) 6 left(90) 7 def main(): 8 setup(800,600) 9 阅读全文
posted @ 2022-06-13 23:21 宋烨 阅读(21) 评论(2) 推荐(0) 编辑
摘要: 1 class User: 2 def __init__(self, name, password='111111', status='1'): # 构造新账户 3 self.name = name 4 self.password = password 5 self.status = status 阅读全文
posted @ 2022-06-07 19:33 宋烨 阅读(19) 评论(1) 推荐(0) 编辑
摘要: 2 f1=open('data3_id.txt','r') 3 list1,list3=[],[] 4 for i in f1.readlines(): 5 list1.append(i.strip().split(',')) 6 def is_valid(x): 7 if len(x)==18: 阅读全文
posted @ 2022-05-25 12:09 宋烨 阅读(10) 评论(2) 推荐(0) 编辑
摘要: 1 with open('data3.txt', 'r', encoding='utf-8') as f: 2 data = f.read().strip().split('\n') 3 data[0] = '原始数据' + '\t' + '四舍五入后数据' + '\n' 4 for i in ra 阅读全文
posted @ 2022-05-16 23:28 宋烨 阅读(16) 评论(2) 推荐(0) 编辑
摘要: 1 print(sum) 2 sum=42 3 print(sum) 4 5 def inc(n): 6 sum=n+1 7 print(sum) 8 return sum 9 10 sum=inc(7)+inc(7) 11 print(sum) 1 def func1(a, b, c, d, e, 阅读全文
posted @ 2022-05-10 21:28 宋烨 阅读(26) 评论(2) 推荐(0) 编辑
摘要: 1 x = list(range(10)) 2 print('整数输出1: ', end = '') 3 for i in x: 4 print(i, end=' ') 5 print('\n整数输出2: ', end = '') 6 for i in x: 7 print(f'{i:02d}', 阅读全文
posted @ 2022-04-11 18:40 宋烨 阅读(29) 评论(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 = {} 阅读全文
posted @ 2022-03-27 12:55 宋烨 阅读(14) 评论(3) 推荐(0) 编辑