- 博客(2)
- 问答 (1)
- 收藏
- 关注
原创 提取纯文本单个字出现的次数(不去重)
文本分词过程中,按顺序计算单字出现的次数(不去重) A_count_B = [] # 提取单字 def A_char(words): for i in words: A_count_B.append(i) print(A_count_B) A_char(words) A_counts_B = [] #出现次数 j = 0 while j < len(A_count_B): word = A_count_B[j] counts2 = A_count_B
2021-12-02 17:27:12
185
原创 Python读取txt文件,出现:TypeError: ‘_io.TextIOWrapper‘ object is not subscriptable问题解决方案
Python读取txt文件并进行文本交叉分词: words = open('words.txt','r') # 文本交叉分词 textlist = [] ## 空列表 def cuttingText(text,num): while(text!=''): textlist.append(text[0:num]) text=text[num-1:] return textlist cuttingText(words,2) print(textlist)
2021-11-29 11:01:38
17936
4
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅