摘要:
import jieba #打开文件,转换成UTF-8编码 fo=open(r'C:\Users\Shaheen\AppData\Local\Programs\Python\Python36\西游记.txt','r',encoding='utf-8') a=fo.read() fo.close() #断词 words=list(jieba.cut(a)) s=set(words) dic={... 阅读全文
摘要:
fo=open('D:/jiu/test.txt','w') fo.write('''Ohh wooaah You know you love me,I know you care You shout whenever, And I'll be there You want my love, You want my heart And we will never ever ever b... 阅读全文
摘要:
1 字典实例:建立学生学号成绩字典,做增删改查遍历操作 a={'01':100,'02':89,'03':88,'04':90}print('字典',a)a['05']=88print('增加05学生成绩为88',a)a.pop('02')print('删除02的学生成绩',a)print('查找0 阅读全文
摘要:
1 实例: 下载一首英文的歌词或文章,将所有,.?!等替换为空格,将所有大写转换为小写,统计某几个单词出现的次数,分隔出一个一个的单词 song='''Ohh wooaah You know you love me,I know you care You shout whenever, And I' 阅读全文
摘要:
1. a=input('明文:')print('密文:',end='')for i in a: print(chr(ord(i)+3),end='') 2 print('{0:''<5}{1:<6}{2:<7}'.format('国家名称','GDP总量','(人民币亿元)'))print('{0: 阅读全文
摘要:
1.已知‘星期一星期二星期三星期四星期五星期六星期日 ’,输入数字(1-7),输出相应的‘星期几’ n='星期一星期二星期三星期四星期五星期六星期七'd=int(input('1-7:'))print(n[3*(d-1):3*d]) 2.输入学号,识别年级、专业、班级、序号 n='201506050 阅读全文
摘要:
画五角星 import turtleturtle.bgcolor('red')turtle.color('yellow')turtle.fillcolor('yellow')turtle.begin_fill()for i in range(5): turtle.forward(80) turtle 阅读全文
摘要:
画一组同切圆 import turtleturtle.circle(50)turtle.circle(60)turtle.circle(70)turtle.circle(80) 画一组同心圆 import turtleturtle.circle(60)turtle.up()turtle.goto(6 阅读全文
摘要:
1. >>> print('hello world')hello world>>> input("what's your name?")what's your name?apple'apple'>>> a='star'>>> print(a)star 2.多行: >>> a=input('输入第一个 阅读全文