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. 匿名函 ...
随机推荐
- java字符串根据正则表达式让单词首字母大写
public class Da { public static void main(String[] args) { String s = "hello_*java_*world" ...
- Python-接口自动化(四)
python基础知识(四) (四)处理文件 a.文件的格式主要有txt.html.xml,接下来主要讲的是txt格式的文件处理 对文件进行读写等操作会用到的函数是open(),第一个参数file是指传 ...
- asp解码.net传参
get传参时 asp默认使用gbk解码?了解的朋友指点下,谢谢 .net向asp传参时注意urlencode加密编码使用gb2312 附:任何语言的数据交互都要确保接收双方的编码一致
- from jobscrawler_qianchengwuyou.items import JobscrawlerQianchengwuyouItem
-- coding: utf-8 -- import scrapy from jobscrawler_qianchengwuyou.items import JobscrawlerQianchengw ...
- 2017年4月13日用VS写C程序遇到的一些问题
在网上找到一篇展示计算机浮点数格式的文章,且有C代码如下: #include <stdio.h> #include <stdlib.h> #include <string ...
- js中关于声明提前的几个误区
声明提前: 在程序正式执行之前,都会将所有的var声明的变量提前到开始位置,集中创建,而赋值留在原地. 例如这样一段代码 console.log(a) var a = 100; console.log ...
- Java——总结
一.编写并运行java程序步骤: 1.编写java源代码 java源代码文件都已java作为扩展名 java代码格式: class 类名{ //主方法} 2.编译,将字符文件编译为字节文件 在dos中 ...
- vim打开txt文件看到^@字符
'\0'是不可见字符,使用vim编辑器查看的文本文件中如果包含'\0'字符,vim会自动将'\0'字符转换为^@字符. 看下面的代码: #include <stdio.h> #includ ...
- spring Onions and wine
Before and after the cold dew, the air is drier and the "autumn dryness" is vulnerable. Nu ...
- 2D 加速图形界面开发源代码亲写 想买来学习得加qq 313244484 20万当前代码,完整400万包写完
#include "StdAfx.h" #include "GUIFrame.h" #include <stdlib.h> #include < ...