摘要:
0、运算符 in:检查字典中是否有某个key 'a' in {'a':1,'b':2} True 提取其中Key对应的Value: d={'1':'A','2':'B','3':'C'} d['2'] #'B' d.get('2') #'B' 1、方法: 方法 说明 dict.clear() 删除d 阅读全文
posted @ 2021-01-30 21:03
ShineLe
阅读(117)
评论(0)
推荐(0)
摘要:
1、List相关的操作符 操作符 说明 例子 * 重复,将List重复若干遍放到同一个List中 ['hi'] * 3 ['hi' , 'hi' , 'hi'] + 合并两个List(作用和append、extend类似) [1,2,3]+[4,5,6] [1,2,3,4,5,6] in 检查元素是 阅读全文
posted @ 2021-01-30 17:12
ShineLe
阅读(94)
评论(0)
推荐(0)
摘要:
wordcloud官方文档 1、简介 wordcloud是优秀的词云展示的第三方库 2、导入模块 import wordcloud 3、wordcloud对象初始化 以下参数值均为官方文档给出的默认值 w=wordcloud.WordCloud( font_path=None, width=400, 阅读全文
posted @ 2021-01-30 14:37
ShineLe
阅读(700)
评论(0)
推荐(1)
摘要:
import re def clean(line): pattern = re.compile(u'[^\u4e00-\u9fa5]') #中文的范围为\u4e00-\u9fa5 line = re.sub(pattern,'',line) #将其中所有非中文字符替换 return line wit 阅读全文
posted @ 2021-01-30 12:56
ShineLe
阅读(3564)
评论(0)
推荐(1)

浙公网安备 33010602011771号