摘要:
这里说的字符串不是一般意义上的字符串,是指在读取日期类型的数据时,如果还没有及时解析字符串,它就还不是日期类型,那么此时的字符串该怎么与时间戳之间进行转换呢? ① 时间字符串转化成时间戳 将时间字符串转化成时间戳分为两步: 第一步:将时间字符串转换成时间元组 第二步:将时间元组转换成时间戳类型 ② 阅读全文
摘要:
If order does not matter, you can use foo = "mppmt" "".join(set(foo)) set() will create a set of unique letters in the string, and "".join() will join 阅读全文
摘要:
import re import pymongo from tqdm import tqdm import hashlib db = pymongo.MongoClient().weixin.text_articles md5 = lambda s: hashlib.md5(s).hexdigest() def texts(): texts_set = set() for a in tqdm(db 阅读全文
摘要:
# 方法一:暴力法,对每个词进行判断 传统方法 def remove_stopwords1(text): words = text.split(' ') new_words = list() for word in words: if word not in stopwords: new_words.append(word) return new_words # 方法二:先构建停用词的映射 推荐方 阅读全文