摘要: #1. aaaFile = open('aaa.txt',mode="r",encoding='utf-8') aaaText = aaaFile.read() aaaFile.close() print(aaaText) #2. replaceList = [',','.',"'",'\n'] for c in replaceList: aaaText = aaaText.re... 阅读全文
posted @ 2018-06-20 20:36 梁伟进 阅读(156) 评论(0) 推荐(0) 编辑
摘要: l = ['Michael','Bob','Tracy'] l.append('Bob') l.pop() print(1) t = ('Michael','Bob','Tracy') scores = [85,65,55] d = {'Michael':85,'Bob':65,'Tracy':55} d['Bob'] = 82 d['Rose'] = 88 d.pop('Bob') p. 阅读全文
posted @ 2018-06-06 21:21 梁伟进 阅读(161) 评论(0) 推荐(0) 编辑
摘要: fr = open('letter.txt',mode='r',encoding='utf-8') plaincode = fr.read() print('明文:' + plaincode) print('密文:',end='') for c in plaincode: print(chr(ord(c)+3),end='') fr = open('88.txt',mod... 阅读全文
posted @ 2018-05-30 21:29 梁伟进 阅读(231) 评论(0) 推荐(0) 编辑
摘要: id = '440681199904105918' 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') plainText=input('我好想你:')... 阅读全文
posted @ 2018-05-23 20:44 梁伟进 阅读(115) 评论(0) 推荐(0) 编辑
摘要: stunum='201709090026' print('年级是:'+stunum[0:4]) print('专业编号是;'+stunum[4:9]) print('序号是:'+stunum[-3:]) IDNo = '4400261199904105918' print('性别是;'+ IDNo[-2]) import turtle turtle.setup(600,400,0,0... 阅读全文
posted @ 2018-05-16 20:42 梁伟进 阅读(138) 评论(0) 推荐(0) 编辑
摘要: import turtle # 画一颗五角星 turtle.forward(100) turtle.right(144) turtle.forward(100) turtle.right(144) turtle.forward(100) turtle.right(144) turtle.forwar 阅读全文
posted @ 2018-05-09 21:05 梁伟进 阅读(171) 评论(0) 推荐(0) 编辑
摘要: myNumber=410 while True: guess=int(input("我的生日")) if guess>myNumber: print("没那么迟") elif guess<myNumber: print("没那么早") else: print("恭喜你猜对了,下课去我儿子吴树生那里领取奖励把") ... 阅读全文
posted @ 2018-05-02 20:36 梁伟进 阅读(148) 评论(0) 推荐(0) 编辑
摘要: while True: a = int(input('摄氏温度转换为华氏温度请按 1\n华氏温度转化为摄氏温度请按 2\n退出请按 3\n')) if a==1: c = float(input('请输入摄氏温度:')) f = (c)*9/5+32 print('摄氏{:.2f}温度转为华氏温度是 阅读全文
posted @ 2018-04-25 21:36 梁伟进 阅读(412) 评论(0) 推荐(0) 编辑
摘要: a = input('请输入一个数') b = input('请输入第二个数') sum2=int(a) + int(b) print('两个数的和是:{}'.format(sum2)) a = input('请输入一个摄氏温度') sum2=int(a) * 9/5 +32 print('转换的华氏温度是:{}'.format(sum2)) 阅读全文
posted @ 2018-04-18 21:40 梁伟进 阅读(220) 评论(0) 推荐(0) 编辑
摘要: name1=input("请输入第一个人的名字") name2=input("请输入第二个人的名字") print("{}养了一头猪,那头猪有个好听的名字,它叫{}".format(name1,name2)) input("press any key") 阅读全文
posted @ 2018-04-18 21:05 梁伟进 阅读(322) 评论(0) 推荐(0) 编辑