asdasf
bigFile = open('big.txt',mode='r',encoding='utf-8')
bigText = bigFile.read()
bigFile.close()
print(bigText)
replaceList=[',','.',"'",'\n']
for c in replaceList:
bigText = bigText.replace(c,'')
print(bigText)
print(bigText.split(' '))
bigList=bigText.split(' ')
print(bigList.count('big'))
bigSet = set(bigList)
print(bigSet)
bigDict ={ }
for word in bigSet:
bigDict[word] = bigList.count(word)
print(bigDict)
for d in bigDict:
print(d,bigDict[d])
wordCountList = list(bigDict.items())
print(wordCountList)
wordCountList.sort(key=lambda x:x[1],reverse=True)
print(wordCountList)
for i in range(20):
print(wordCountList[i])
bigCountFile = open('bigCount.txt', mode='a',encoding='utf-8')
for i in range(len(wordCountList)):
bigCountFile.write(str(wordCountList[i][1])+' '+wordCountList[i][0]+'\n')
bigCountFile.close()

asdasf的更多相关文章
- python 正则表达式点号与'\n'符号的问题
遇到了一个小虫,特记录之. 1.正则表达式及英文的处理如下: >>> import re >>> b='adfasdfasf<1safadsaf>23w ...
- js 获取字符串中最后一个斜杠后面的内容
var str = "/asdasf/asfaewf/agaegr/trer/rhh"; var index = str .lastIndexOf("\/"); ...
- js截取最后一个斜杠之后的内容
var str = "/asdasf/asfaewf/agaegr/trer/rhh"; var index = str .lastIndexOf("\/"); ...
- AJAX增删查
数据库 CREATE DATABASE crmweb; CREATE TABLE `customerstatus` ( `id` bigint(20) NOT NULL AUTO_INCREMENT ...
- 匿名函数 python内置方法(max/min/filter/map/sorted/reduce)面向过程编程
目录 函数进阶三 1. 匿名函数 1. 什么是匿名函数 2. 匿名函数的语法 3. 能和匿名函数联用的一些方法 2. python解释器内置方法 3. 异常处理 面向过程编程 函数进阶三 1. 匿名函 ...
随机推荐
- 如何更有效地说服开发接收你的bug?!
来来来,测试小伙伴们,看看以下这张图是不是觉得很熟悉.. 虽然这张图带点戏谑的成分,但确实折射出大部分IT公司测试人员在报bug时,与开发的沟通存在些许问题.如何更有效地说服开发接收你的bug,以下整 ...
- .net core webapi 使用ValidationAttribute对比同一对象的多个参数
众所周知,在使用DataAnnotations数据验证的时候,特别是针对同一个InputDto的多个属性进行对比的时候,例如起始日期不能大于结束日期,我们需要在Attribute中知道当前InputD ...
- GCP 谷歌云平台申请教程
最近为了学个国外的课程,想要用谷歌云平台的GPU,谷歌云平台,新注册,赠送300美金,免费用一年.注册的时候发现,必须要有国外的信用卡,网上搜索,并试了几个解决方案. 1.不用信用卡,能不能申请成功? ...
- HTTP与HTTPS有哪些区别?
大纲 这里写图片描述一.前言: 这里写图片描述这里写图片描述先来观察这两张图,第一张访问域名http://www.12306.cn,谷歌浏览器提示不安全链接,第二张是https://kyfw.1230 ...
- 几个常用内核函数(《Windows内核情景分析》)
参考:<Windows内核情景分析> 0x01 ObReferenceObjectByHandle 这个函数从句柄得到对应的内核对象,并递增其引用计数. NTSTATUS ObRefer ...
- Database First/Code First
- 第八次作业:聚类--K均值算法:自主实现与sklearn.cluster.KMeans调用
import numpy as np x = np.random.randint(1,100,[20,1]) y = np.zeros(20) k = 3 def initcenter(x,k): r ...
- BigDecimal类的用法
(一)BigDecimal类的常用的几个构造方法 BigDecimal(int):将int表示形式转换为BigDecimal对象 BigDecimal(String):将字符串表示形式转换为BigDe ...
- iphone html5页面禁止点击数字就打电话
在html页面的head代码之间增加下面代码: <meta name="format-detection" content="telephone=no" ...
- python+appium 自动化2--元素定位uiautomatorviewer
出处:https://www.cnblogs.com/yoyoketang/p/6128741.html 前言: 可以打开手机上的app了,下一步元素定位uiautomatorviewer,通过定位到 ...