Basic banner grabbing with Python
I’m attempting to write a bot and I was trying to find some information about ports on other computers. If anyone could help me out, I would appreciate it. When you create a socket in python, what does...
View Articlepython配置文件操作
在我们写一个功能性的python脚本时,有时需要读取一个配置文件,这个配置文件可以给用户自定义修改,以实现程序的最大灵活性,谈到配置文件的修改,这对我们运维人员来说都应该不陌生,不管你维护的是web站点还是游戏项目或其它,运维的工作估计很大部分是内容就是通过修改配置文件来完成的,如果任何修改都要改代码去编译,那估计也没什么可运维性的了,当然回到运维的工作,我们日常写的维护脚本一般涉及不到特别复杂的配...
View ArticlePython--关于dict
本文内容摘录自慕课网《python 入门》 1、dict 特性 dict用花括号{}表示,然后按照 key: value, 写出来即可。最后一个 key: value 的逗号可以省略。 ①、 dict 的查找速度快 , 无论dict有10个元素还是10万个元素,查找速度都一样 。而list的查找速度随着元素增加而逐渐下降。 dict的缺点是占用内存大 ,还会浪费很多内容...
View ArticleIs Phoenix going to take over the tech industry?
(written by lawrence krubner, however indented passages are often quotes) If not, why? This has been one of the big puzzles of the last 30 years: if some technologies are clearly superior, then why...
View Article使用 VS Code 远程调试 Python 程序
在上一篇文章 远程调试你的 python 代码 中,我简单介绍了 Python 世界中的两种远程调试模型:PyCharm 选择的 debugger as debug server 模式和 VS Code 提供的 debugger as debug client 模式,并分享了 PyCharm 的远程调试适用于单体应用,VS Code 的远程调试适用于大规模的分布式应用的观点。...
View ArticlePyCharm: PyCharm Edu 3 coming soon
Today we’re announcing that PyCharm Edu 3 is coming this August, right before the new school year. Since the previous release we’ve tremendously improved PyCharm Edu for teachers and course authors,...
View ArticleBogoSort or Permutation Sort
BogoSort also known as permutation sort, stupid sort, slow sort, shotgun sort or monkey sort is a particularly ineffective algorithm based on generate and test paradigm. The algorithm successively...
View ArticleCoconut赋予Python函数式编程语法
长期以来,很多python的粉丝都强烈要求Python加入函数式编程的特性。现在他们可以不必切换到别的实现版本,就可以获得这项特性。 Coconut 是一个最近开发出的Python方言,提供了像函数式编程语言Haskell和Scala那样的语法。使用Coconut编写的程序可以编译成普通的Python代码,所以可以直接使用原来的Python解释器运行。...
View ArticleIdiomatic Python: EAFP versus LBYL
One idiomatic practice in python that often surprises people coming from programming languages where exceptions are considered, well, exceptional, is EAFP : “it’s easier to ask for forgiveness than...
View Article《Think Python 2e》最新版中文翻译 第二章:变量、表达式和语句
编程语言最强大的特性之一,是操作 变量 的能力。变量是指向某个值的名称。 赋值语句 赋值语句(assignment statement)会新建变量,并为这个变量赋值。 >>> message = 'And now for something completely different' >>> n = 17 >>> pi =...
View Article用Python挖掘Twitter数据Part1:数据采集
本文为数盟原创译文,转载请注明出处为数盟社区。 这是7部系列中的第1部分,注重挖掘Twitter数据以用于各种案例。这是第一篇文章,专注于数据采集,起到奠定基础的作用。 来自独立数据科学顾问 Marco Bonzanini...
View Article哈夫曼编码 ―― Lisp 与 Python 实现
SICP 第二章主讲对数据的抽象,可以简单地理解为 Lisp 语言的数据结构。当然这样理解只可作为一种过渡,因为 Lisp 中并不存在数据与过程的差别,也就完全不需要一个额外的概念来描述这种对数据抽象的过程。 2.3.4 以哈弗曼编码为例展示了如何在 Lisp 中实现哈夫曼二叉树数据结构的表示与操作,本文在完成该小节习题(完整的哈夫曼编码树生成、解码与编码)的基础上,将 Lisp(这里用的是...
View ArticleWriting A Full Site in Phoenix and Elm
Part 2: Making HTTP Calls From Elm Last Updated June 29th, 2016 Current Versions Elixir:v1.3.1, Phoenix: v1.2.0, Elm: v0.17 Previous Post In This Series Writing A Full Site in Phoenix and Elm Current...
View Articledjango 之 常用命令
Django 基本命令 本节主要是为了让您了解一些django最基本的命令, 请尝试着记住它们,并且多多练习下 1. 新建一个 django project django-admin.pystartprojectproject-name 一个 project 为一个项目,project-name 项目名称,改成你自己的,要符合python 的变量命名规则(以下划线或字母开头) 2. 新建 app...
View ArticleMulticore Python: A tough, worthy, and reachable goal
python has been held back by its inability to natively use multiple CPU cores. Now Pythonistas are aiming to find a solution For all of Python's great and convenient features , one goal remains out of...
View ArticlePython--关于 join 和 split
.join() join将 容器对象 拆分并以指定的字符将列表内的元素(element)连接起来,返回字符串(注:容器对象内的元素须为字符类型) >>> a = ['no','pain','no','gain'] >>> '_ '.join(a) 'no_pain_no_gain' >>> 注:容器对象内的元素须为字符类型...
View ArticlePyPy 5.1 puts Python's pedal to the metal
The optimizing compiler features powerful performance improvements, but the default version of python has its own speed tricks slated for version 3.6 PyPy, the just-in-time optimizing compiler for...
View Article[django]数据导出excel升级强化版(很强大!)
不多说了,原理采用xlwt导出excel文件,所谓的强化版指的是实现在网页上选择一定条件导出对应的数据 之前我的博文出过这类文章,但只是实现导出数据,这次左思右想,再加上网上的搜索,终于找出方法实现条件导出的功能了. 先上图: 再说明:核心是使用django视图中的命名组,例如配置url(r'^perm=(?P<a>\w+)$', 'keywork.views.work)...
View ArticleReinout van Rees: Djangorecipe: easy test coverage reports
Code coverage reports help you see which parts of your code are still untested. Yes, it doesn’t say anything about the quality of your tests, but at the least it tells you which parts of your code have...
View ArticleTalk Python to Me: #65 Jump on the real-time web with RethinkDB
Episode #65: Jump on the real-time web with RethinkDB Published Wed, Jun 29, 2016, recorded Wed, Jun 22, 2016. ( embed this episode ) Long gone are the days of the web acting as just linked documents...
View Article