随笔
Moonskr
这个作者很懒,什么都没留下…
展开
-
如何同时用python处理多个文本生成词云图,这篇文章就够了
# -*- coding: utf-8 -*- """ Created on Wed Apr 22 21:22:42 2020 @author: Administrator """ import os import jieba from collections import Counter from wordcloud import WordCloud import numpy as np ...原创 2020-04-22 23:35:12 · 1786 阅读 · 0 评论 -
python中zip()函数用法
zip函数的用法 >>>A = ["a" ,"b", "c"] >>>B = [1, 2, 3] >>>C = zip(A,B) >>>C <zip object at 0x000001A0B1591888> >>>D = list(C) >>>D [('a', 1), ('b...原创 2020-04-06 22:23:10 · 151 阅读 · 0 评论 -
python 函数闭包和生成器结合
柯里化(Curring) def add(x,y): return x + y add(2,1) # 转换下 >>> def add(x): >>> def _add(y): >>> return x + y >>> return _add >>> foo = add(2) >&g...原创 2020-04-07 23:17:32 · 179 阅读 · 0 评论 -
OrderedDict()的用法
OrderedDict()的用法 >>>from collections import OrderedDict >>>a = OrderedDict(name = 'jessac',age = 23) >>>print(a) OrderedDict([('name', 'jessac'), ('age', 23)]) >>>...原创 2019-11-24 12:49:37 · 5448 阅读 · 1 评论 -
随笔11-24
python中append和extend的区别 ''' append只能单个添加元素,extend能整体添加,但只能添加可迭代目标 ''' list1 = [1, 2, 3, 4] list2 = [2, 3, 4, 5] l_append = list1.append(1) print(1_append) >>> a [1, 2, 3, 4, 1] print(list2.ex...原创 2019-11-24 12:22:33 · 92 阅读 · 0 评论