摘要: from turtle import * def square(size=50, rgb='orange'): pencolor(rgb) for i in range(4): fd(size) left(90) def main(): setup(800,600) speed(0) n=10 fo 阅读全文
posted @ 2022-06-13 17:03 q^ 阅读(16) 评论(0) 推荐(0) 编辑
摘要: class User: """用户""" count = 0 def __init__(self, name='guest', password=111111, status=1): User.count += 1 self.name = name self.password = password 阅读全文
posted @ 2022-06-09 10:33 q^ 阅读(31) 评论(1) 推荐(0) 编辑
摘要: f1=open('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 x: 阅读全文
posted @ 2022-05-28 16:48 q^ 阅读(11) 评论(1) 推荐(0) 编辑
摘要: with open('data3.txt','r',encoding='utf-8')as f1: with open('data3_processed.txt','w',encoding='utf-8')as f2: a=f1.read().split('\n') a.pop(0) c=[] d= 阅读全文
posted @ 2022-05-17 10:42 q^ 阅读(29) 评论(1) 推荐(0) 编辑
摘要: print(sum)sum = 42print(sum)def inc(n): sum = n+1 print(sum) return sumsum = inc(7) + inc(7)print(sum) def func1(a, b, c, d, e, f): ''' 返回参数a,b,c,d,e, 阅读全文
posted @ 2022-05-08 14:20 q^ 阅读(24) 评论(1) 推荐(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 阅读全文
posted @ 2022-04-28 09:31 q^ 阅读(43) 评论(7) 推荐(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 = '-') # 指 阅读全文
posted @ 2022-04-11 18:33 q^ 阅读(31) 评论(3) 推荐(0) 编辑
摘要: print('hey, u') print('hey', ' u') x,y,z = 1,2,3 print(x, y, z) print('x = %d, y = %d, z = %d'%(x,y,z)) print('x = {}, y = {}, z = {}'.format(x,y,z)) 阅读全文
posted @ 2022-03-28 18:14 q^ 阅读(187) 评论(3) 推荐(0) 编辑