ICode9

精准搜索请尝试: 精确搜索
  • Django练习2021-11-17 17:01:13

    url传参实现加减乘除 1,urls里编写path path('computer/<int:num1>/<str:op>/<int:num2>/', views.get_result_view), 2,views里编写 def get_result_view(request , num1 , op , num2): oplist = ['+','_','*','di

  • jieba2021-11-14 11:33:42

    import jiebatxt=open('D:\桌面\西游记.txt',"r",encoding='utf-8').read()excludes={"什么","一个","那里","怎么","我们","不知","两个","甚么",\"不是","只见&qu

  • 用jieba统计《红楼梦》词频2021-11-14 11:31:48

    import jieba jieba.setLogLevel(jieba.logging.INFO) f = open('红楼梦.txt', 'r', encoding='utf-8') txt = f.read() f.close() words = jieba.lcut(txt) counts = {} for word in words: if len(word) == 1: continue elif wo

  • 西游记词频统计2021-11-14 10:34:58

    import jiebajieba.setLogLevel(jieba.logging.INFO)txt = open('西游记.txt', 'r', encoding='gb18030').read()words = jieba.lcut(txt)counts = {}for word in words: if len(word) == 1: continue elif word == "大圣" o

  • jieba2021-11-14 10:31:38

    import jieba txt = open("聊斋志异白话简写版.txt", "r", encoding='utf-8').read()words = jieba.lcut(txt) # 使用精确模式对文本进行分词counts = {} # 通过键值对的形式存储词语及其出现的次数 for word in words: if len(word) == 1: continue elif

  • jieba分词 西游记2021-11-14 10:01:27

    import jieba   txt = open("《西游记》.txt", "r", encoding='utf-8').read() words = jieba.lcut(txt)  # 使用精确模式对文本进行分词 counts = {}  # 通过键值对的形式存储词语及其出现的次数   for word in words:     if len(word) == 1:         continue

  • 聊斋jieba2021-11-14 09:00:07

    import jieba txt = open("聊斋志异白话简写版.txt", "r", encoding='utf-8').read()words = jieba.lcut(txt) # 使用精确模式对文本进行分词counts = {} # 通过键值对的形式存储词语及其出现的次数 for word in words: if len(word) == 1: continue elif

  • jieba 分词-西游记2021-11-14 02:32:20

    import jieba def takeSecond(elem): return elem[1] def main(): path = "西游记.txt" file = open(path,"r",encoding="utf-8") text=file.read() file.close() words = jieba.lcut(text) counts = {} fo

  • 乒乓球比赛2021-11-14 02:01:07

    import random as adef getput(): jia = eval(input('甲的胜率:')) yi = eval(input('乙的胜率:')) n = eval(input('比赛场次:')) return jia,yi,n def bishaileixing(): c=input('比赛类型:') if c =='单打淘汰赛':

  • 西游记相关的分词2021-11-13 22:34:10

    import  jieba txt = open("西游记.txt", "r", encoding='utf-8').read() words = jieba.lcut(txt) counts = {} for word in words:     if len(word) == 1:         continue        elif word == "大圣" or word=="老孙" or wo

  • jieba分词《西游记》2021-11-13 20:03:13

    代码如下: import jieba txt = open("《西游记》.txt", "r", encoding='utf-8').read()words = jieba.lcut(txt) # 使用精确模式对文本进行分词counts = {} # 通过键值对的形式存储词语及其出现的次数 for word in words: if len(word) == 1: continue elif word =

  • Python经典问题——身体指数BMI2021-11-11 09:03:41

    BMI :Body Mass Index 国际上常用的衡量人体肥胖和健康程度重要标准,主要用于统计分析‪‬‪‬‪‬‪‬‪‬‮‬‫‬‮‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‪‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‪‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‭‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‪‬‪‬‪‬‪‬‪‬‪

  • Python 坦克大战2021-11-09 17:06:41

    Python 坦克大战 运行环境:python3.8.3+pygame1.9.6 代码包下载:点击此处下载 主程序文件:game.py 准备工作 1、pygame安装 pip install pygame -i https://mirrors.ustc.edu.cn/pypi/web/simple 2、numpy安装 pip install numpy -i https://mirrors.ustc.edu.cn/pypi/web/simple

  • python练习22021-11-09 09:02:30

    python小练习2 6、怎么得到9 / 2的小数结果 >>> 9/2 4.5 7、判断一个数n能否同时被3和5整除 If n%3==0 and n%5==0 8、python计算中7 * 7 *7 * 7,可以有多少种写法 >>> 7**4 2401 9、写程序将温度从华氏温度转换为摄氏温度。转换公式为C = 5 / 9*(F - 32) F=(c+32)/9*5     10、

  • 判断是否为酒驾2021-11-08 21:03:12

    # 判断是否为酒驾 # 作者:安芸 # 时间:2021年11月8日 a =int(input('请输入驾驶员每100ml血液里的酒精含量: ')) if a >=80: print('您已为醉酒驾驶,请接受坐牢的思想准备') elif a>=20: print('您为饮酒驾驶,请靠边等待接受泸州警官的处罚') else: print('是个

  • Python基础知识3: if判断语句2021-11-06 18:05:33

    一、判断的定义 如果 条件满足,才能做某件事, 如果 条件不满足,就做另外一件事情,或者什么也不做 另外:判断语句 又被称为 “分支语句”,正是因为有了判断,才让程序有了很多的分支。 二、if 语句体验 2.1、在Python中,if 语句 就是用来进行判断的,格式如下: if 要判断的条件: 条

  • 定义学生信息类2021-11-06 14:02:12

    class Student(): def __init__(self, name, score): self.name = name self.score = score def print_grade(self): if self.score >= 90: print(f'学员姓名:{self.name},学员成绩:{self.score},优秀') elif self.s

  • python入坟的第一天2021-11-06 13:30:17

    猜数游戏(低版本) """ 01~100之间随意产生一个数字 让用户反复猜测, 只提示猜大了,猜小了 猜对了结束游戏 """ import random #引入一个随机模块 #使用随机数模块生成了一个1~100整数 target = random.randint(1,100) while True: n=int(input('猜一个1~100的整数')) if n >

  • 流程控制2021-11-06 03:00:15

    目录流程控制概要流程控制详解顺序结构分支结构if分支结构循环结构while循环体for循环体 流程控制概要 流程控制即为控制流程,具体指控制程序执行的流程。大体可分为三种结构:顺序结构、分支结构、循环结构 流程控制详解 顺序结构 自上而下依次运行,没啥特别的 流程图: 分支

  • bash编程控制语句2021-11-05 23:03:25

    if 比较两个变量的大小并输出不同的值i f [ $a -eq $b ]; then echo “equal”; elif [ $a -lt $b ];then echo “small”; elif [ $a -gt $b ];then echo “big”;fi for 循环读取文件内容并输出for i in $(cat dir.txt);do echo $i;done while 循环读取文件内容并输出while read

  • 2021-11-052021-11-05 11:34:42

    class Solution: def mySqrt(self, x: int) -> int: for i in range(x+1): if i*i == x: return i break elif i*i > x: return i - 1 break

  • 猜拳游戏:(python)2021-11-04 21:34:32

    答案1: 思路: 随机数可以出来 输入数之后 依次比较数的大小判断输赢。 import random x=random.randint(0,2) print(x) #剪刀(0),石头(1),布(2) c = int(input("输入剪刀(0),石头(1),布(2):")) if c==0: if x==0: print("平局") elif x==1: print("哈哈

  • 进制转化2021-11-02 21:01:50

    作业要求 用Python或Scratch实现下面伪代码描述的进制转换程序,提交运行结果截图,至少三张,包含转换为二进制,八进制,十六进制的截图。 Write "Enter the new base" Read newBase Write "Enter the number to be converted" Read decimalNumber Set quotient to 1 WHILE (quotient is n

  • shell 脚本中时间截取进制的问题2021-11-01 14:00:28

      我们执行以下的代码会发现思路也对,脚本写的格式也没错但是会报    line 29: [[: 08: value too great for base (error token is "08") 的错误。           date_time=`date +"%Y%m%d%H%M"`         //截取想要的时间          date_d=${date_ti

  • Leetcode 401~4202021-11-01 12:29:59

    412. Fizz Buzz 知识点: 列表 list append % 求模运算(余数) class Solution: def fizzBuzz(self, n: int) -> List[str]: res = [] for i in range(1, n+1): # if not i%15: # tmp = "FizzBuzz" # elif not i

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有