摘要: f = open('歌词.txt',mode='r',encoding='utf-8') fText = f.read() f.close() print(fText) If I got down on my knees And I pleaded with you If I cross a million oceans Just to be with you Would you e... 阅读全文
posted @ 2018-06-13 21:49 Milliezhu 阅读(157) 评论(0) 推荐(0) 编辑
摘要: def hanoi(n,a,b,c): if n==1: print(n,a+'->'+c) else: hanoi(n-1,a,c,b) print(n,a+'->'+c) hanoi(n-1,b,a,c) hanoi(5,'A','B','C') 1 A->C 2 A->B 1 C->B 3 A->C 1 ... 阅读全文
posted @ 2018-06-13 20:29 Milliezhu 阅读(133) 评论(0) 推荐(0) 编辑
摘要: l = ['Michael','Bob','Tracy'] l.append('Rose') l.pop() t = ('Michael','Bob','Tracy') print(l) ['Michael', 'Bob', 'Tracy'] scores = [90,80,70] d = {'Michael':90,'Bob':80,'Tracy':70} d['Bob' 阅读全文
posted @ 2018-06-06 21:43 Milliezhu 阅读(343) 评论(0) 推荐(0) 编辑
摘要: classmates = ['Michael','Bob','Tracy'] classmates.append('Rose') classmates.insert(1,'Jack') classmates.pop() classmates.pop(0) classmates[0] = 'Tom' print(classmates) ['Tom', 'Bob', 'Tracy'] 阅读全文
posted @ 2018-05-30 21:37 Milliezhu 阅读(135) 评论(0) 推荐(0) 编辑
摘要: fr = open('letter.txt.txt', mode='r', encoding='utf-8') plaincode = fr.read() print('明文:' + plaincode) print('密文:', end='') for c in plaincode: print(chr(ord(c)+3),end='') 明文:一小时后行动。 ... 阅读全文
posted @ 2018-05-30 21:29 Milliezhu 阅读(222) 评论(0) 推荐(0) 编辑
摘要: s = input('明文:') for c in s: print(chr(ord(c)+3),end='') 明文:i love you l#oryh#|rx Process finished with exit code 0 s = input('密文:') for c in s: print(chr(ord(c)-3),end='') 密文:l#oryh#|r... 阅读全文
posted @ 2018-05-23 21:09 Milliezhu 阅读(138) 评论(0) 推荐(0) 编辑
摘要: for i in range(12): print(i,chr(9800+i)) 0 ♈ 1 ♉ 2 ♊ 3 ♋ 4 ♌ 5 ♍ 6 ♎ 7 ♏ 8 ♐ 9 ♑ 10 ♒ 11 ♓ 阅读全文
posted @ 2018-05-23 20:19 Milliezhu 阅读(118) 评论(0) 推荐(0) 编辑
摘要: id = '440711199809024227' area = id[0:6] birthday = id[6:14] sex = id[-2] print(area,birthday,sex) if (int(sex) % 2 == 0): print('girl') else: print('boy') 年级是:2017 专业编号是:09090 序号是:008 性别... 阅读全文
posted @ 2018-05-23 20:15 Milliezhu 阅读(141) 评论(0) 推荐(0) 编辑
摘要: stuNum = '201709090008' print('年级是:'+stuNum[0:4]) print('专业编号是:'+stuNum[4:9] print('序号是:'+stuNum[-3:]) IDNo = '440711199809024227' print('性别是:'+IDNo[2]) print('市区是:'+IDNo[0:6]) print('年月日是:'+IDNo[7:... 阅读全文
posted @ 2018-05-16 21:50 Milliezhu 阅读(66) 评论(0) 推荐(0) 编辑
摘要: import turtle #画一个五角星 turtle. setup(600,400,0,0) turtle.bgcolor('red') turtle.pencolor('yellow') turtle.fillcolor('yellow') def mygoto(x,y): turtle.pe 阅读全文
posted @ 2018-05-16 21:20 Milliezhu 阅读(135) 评论(0) 推荐(0) 编辑