摘要: #1 bigFile= open('The Magic City.txt', mode='r', encoding='utf-8') bigText=bigFile.read() bigFile.read() #2 replaceList=['?',',','.','!',':',"'",'"',' ','\ufeff','\n'] for c in replaceL 阅读全文
posted @ 2018-06-20 20:49 涂文君 阅读(91) 评论(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(3,'A','B','C') 阅读全文
posted @ 2018-06-13 20:53 涂文君 阅读(116) 评论(0) 推荐(0) 编辑
摘要: l=['Mike','Bob','Tom'] l.append('Bob') l.pop() print(1) t=('Mike','Bob','Tom') scores=[90,70,60] d={'Mike':90,'Bob':70,'Tom':60} d['Tom']=88 d['Jack']=60 d.pop('Tom') print(d) s1={'Mike',& 阅读全文
posted @ 2018-06-06 21:11 涂文君 阅读(101) 评论(0) 推荐(0) 编辑
摘要: fr = open('1.txt', mode='r', encoding='utf-8') plauncode=fr.read() fr.read() fw = open('1-1.txt', mode='a', encoding='utf-8') for c in plauncode: fw.write(chr(ord(c)+1)) fw.close() fr = open('... 阅读全文
posted @ 2018-05-30 20:45 涂文君 阅读(88) 评论(0) 推荐(0) 编辑
摘要: id='440801199910060620' 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') for i in range(12): print(9800+i,chr(98... 阅读全文
posted @ 2018-05-23 19:57 涂文君 阅读(95) 评论(0) 推荐(0) 编辑
摘要: import turtle turtle.setup(600,400,0,0) turtle.bgcolor('red') turtle.color('yellow') turtle.fillcolor('yellow') def mygoto(x,y): turtle.penup() turtle.goto(x,y) turtle.pendown() def draw5... 阅读全文
posted @ 2018-05-16 20:16 涂文君 阅读(121) 评论(0) 推荐(0) 编辑
摘要: import turtle turtle.bgcolor('red') turtle.pencolor('yellow') turtle.fillcolor('yellow') turtle.begin_fill() for i in range(5): turtle.forward(100) turtle.right(144) turtle.end_fill() turtle.... 阅读全文
posted @ 2018-05-09 20:35 涂文君 阅读(235) 评论(0) 推荐(0) 编辑
摘要: number=20 print('猜数字游戏!') while True: a=int(input('请输入数字:')) if anumber: print('猜的数字大了') else: print('猜对了!') break import turtle turtle.circle(75) turtle.done()... 阅读全文
posted @ 2018-05-02 20:30 涂文君 阅读(89) 评论(0) 推荐(0) 编辑
摘要: while True: a=input('摄氏温度转华氏温度按1\n华氏温度转摄氏温度按2\n退出按3\n') if a=='1': a=float(input('请输入摄氏温度:')) b=a*9/5+32 print('{}摄氏温度转化为华氏温度是{:.2f}'.format(a,b)) elif a=='2': ... 阅读全文
posted @ 2018-04-25 21:17 涂文君 阅读(369) 评论(0) 推荐(0) 编辑
摘要: a = input('请输入一个数:') b = input('请输入第二个数:') sum2=int(a) + int(b) print('两个数的和是:{}'.format(sum2)) a=input('请输入摄氏温度:') b=float(a)*9/5+32 print('{}摄氏温度转化为华氏温度是{}'.format(a,b)) c=float(input('... 阅读全文
posted @ 2018-04-18 21:41 涂文君 阅读(171) 评论(0) 推荐(0) 编辑