摘要: 1. 编写文件copy工具 ori_file=input('原文件路径:').strip() cop_file=input('新文件路径:').strip() with open(r'{}'.format(ori_file), mode='rt', encoding='utf-8') as f1,\ 阅读全文
posted @ 2020-12-26 15:25 Avery_W 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 1. 有列表['alex',49,[1900,3,18]],分别取出列表中的名字,年龄,出生的年,月,日赋值给不同的变量 l = ['alex', 49, [1900, 3, 18]] name = l[0] age = l[1] age_year = l[2][0] age_month = l[2 阅读全文
posted @ 2020-12-26 15:19 Avery_W 阅读(64) 评论(0) 推荐(0) 编辑
摘要: for循环 1. for循环嵌套之打印99乘法表 # ①矩形输出九九乘法表: for i in range(1,10): for j in range(1,10): print(f'{i}X{j}={i*j}',end='') print() # ②左下三角形式九九乘法表: for i in ran 阅读全文
posted @ 2020-12-26 15:14 Avery_W 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 1. 使用while循环输出1 2 3 4 5 6 8 9 10 count = 0 while count < 10: count += 1 if count == 7: continue print(count) 2. 求1-100的所有数的和 count = 0 i = 0 while cou 阅读全文
posted @ 2020-12-26 15:07 Avery_W 阅读(58) 评论(0) 推荐(1) 编辑
摘要: 1. 用户输入姓名、年龄、工作、爱好 ,然后打印成以下格式 info of Egon Name : EgonAge : 22Sex : maleJob : Teacher end name = input('Name:') age = input('Age:') sex = input('Sex:' 阅读全文
posted @ 2020-12-26 15:01 Avery_W 阅读(68) 评论(0) 推荐(0) 编辑
摘要: 嵌套取值操作 1. 请取出第一个学生的第一个爱好 students_info = [['egon', 18, ['play', ]], ['alex', 18, ['play', 'sleep']]] print(students_info[0][2][0]) 2. 针对字典,请取出取公司名 inf 阅读全文
posted @ 2020-12-26 14:46 Avery_W 阅读(55) 评论(0) 推荐(0) 编辑