将一个py脚本从Centos转到win运行,出错如下: UnicodeDecodeError: 'gbk' codec can't decode byte 0xff in position 0: illegal multibyte sequence 虽然明白是编码的问题,网络上decode()什么的,貌似不适用python3.后来发现使用字节方式打开可以.出错函数如下:gridfs.GridFS.put()函数.其中调用了读写操作 If you want raw bytes then you n…
百度到<金庸小说全集 14部>全(TXT)作者:金庸 下载下来,然后读取内容with open('names.txt') as f: data = [line.strip() for line in f.readlines()] novels = data[::2] names = data[1::2] novel_names = {k: v.split() for k, v in zip(novels, names)} //可以在这里打印下看是不是都读取过 //开始分词并加载 for _,…
Edited by Markdown Refered from: John Ladd, Jessica Otis, Christopher N. Warren, and Scott Weingart, "Exploring and Analyzing Network Data with Python," The Programming Historian 6 (2017), https://programminghistorian.org/en/lessons/exploring-an…