【列表解析式】Python的单行操作秀

##0x00 前言

1
items = [line for line in open('test.txt', 'rb')]

通常,我们会在代码中看到一些形似上面的炫目操作(什么你们觉得很正常?好嘛是我菜了QvQ)

我一头猛扎进了python的怀抱,正是因为“人生苦短,我用python”,可能是相似的原因,我第一眼就看上了这种表达方式,并且乐于在自己的代码中使用这种方式来更加精简与清晰地生成所需要的列表。

由于在项目实现过程中产生过大量的问题与需求,在无数次尝试之后决定总结一下如何使用列表解析式(也可称作链表推导式,本文中使用前者,不为什么,因为觉得这很Coooooool呀~)来解决这些类型的问题。

Read More

【选课脚本】用Python网页爬虫来进行选(qiang)课

0x00 前言

每当选课的时候,都如同打仗一般
都有自己想要的课,但是名额就那么一点
于是各显神通,有人用js,有人用chrome的console
人生苦短,我用Python

Read More

【Editdistance】在Windows环境下配置python库editdistance

编辑距离是文本处理中很常见的一种判别相似度的方法,

Wikipedia
In computer science, edit distance is a way of quantifying how dissimilar two strings (e.g., words) are to one another by counting the minimum number of operations required to transform one string into the other.

Given two strings a and b on an alphabet Σ (e.g. the set of ASCII characters, the set of bytes [0..255], etc.), the edit distance d(a, b) is the minimum-weight series of edit operations that transforms a into b. One of the simplest sets of edit operations is that defined by Levenshtein in 1966:[2]

Read More

【TensorFlow】Windows10下配置TensorFlow环境

0x00 前言

前言什么的也懒得说了……
总之:
TeamViewer中转+VNC连接来图形化,
SecureCRT两重ssh跳转来改代码,
以及paste.ubuntu.com来复制粘贴,
这样的日子我已经受够了…… 我要在我的windows上配一个!

Read More

【Theano】环境配置——“g++ not detected”

0x00 前言

不管想要做些什么,配置环境总是最让人头疼的部分……
看了半天的Theano,终于打算跑跑程序瞧瞧了……
谁知道新的一轮配置才刚刚开始……
提示:懒得看我那么多废话的可以直接跳到配置方法

Read More