Quantcast
Channel: CodeSection,代码区,Python开发技术文章_教程 - CodeSec
Browsing all 9596 articles
Browse latest View live

Scrapy: AttributeError: 'list' object has no attribute 'iteritems'

在学习Scrapy的过程中,跟着极客学院的课程模仿着写了一个爬取dz模板网站的爬虫,在本地运行的好好的,但是拷贝到服务器上就GG了,报了如题目所示的错误。 产生原因 Scrapy不同版本间不兼容所致,我的本机是Ubuntu16.04,安装Scrapy比较久远了,是1.0.x版本,在这个版本下,跟极客学院的课程同步,settings.py文件中配置ITEM_PIPELINES的时候做如下配置:...

View Article


Python内置函数(9)――callable

英文文档: callable ( object ) Returnif the object argument appears callable,if not. If this returns true, it is still possible that a call fails, but if it is false, calling object will never succeed. Note...

View Article


Python语言十分钟快速入门

python语言十分钟快速入门 一点号数据分析精选1小时前...

View Article

Image may be NSFW.
Clik here to view.

python10min系列之多线程下载器

今天群里看到有人问关于python多线程写文件的问题,联想到这是reboot的架构师班的入学题,我想了一下,感觉坑和考察的点还挺多,可以当成一个面试题来问,简单说一下我的想法和思路吧,涉及的代码和注释在github 跪求star 本文需要一定的python基础,希望大家对下面几个知识点有所了解 python文件处理,open write 简单了解http协议头信息 os,sys模块...

View Article

[Python]-17-socket编程

引言 这篇文章介绍python内置socket模块,使用这个模块模拟一个HTTP GET请求,并将服务器返回的数据保存到本地。 文章目录 0×1.使用TCP传输数据...

View Article


Image may be NSFW.
Clik here to view.

Python的装饰器decorator

python的装饰器decorator 作者:王大为 时间:2016-10-19 一、装饰器的本质 本质:装饰器本身就是一个函数,高阶函数+嵌套函数==>装饰器 原则: * 1、不能修改被装饰函数的源代码 * 2、不能修改被装饰函数的调用方式 二、装饰器需要的知识储备 1、函数即变量 2、高阶函数 3、嵌套函数 三、函数即变量...

View Article

Visualizing Bayes’ Theorem with D3

I have been interested in getting better at Bayesian statistics recently. For my Ranking PGA Tour golfers project, I have been looking at Approximate Bayes’ Computation. This involves discretizing a...

View Article

在 Python 里设置 stdout 的编码

有时候进程的运行环境里,locale 会被设置成只支持 ASCII 字符集的(比如 LANG=C)。这时候 python 就会把标准输出和标准错误的编码给设置成 ascii,造成输出中文时报错。 一种解决办法是设置支持 UTF-8 的 locale,但是那需要在 Python 进程启动前设置。启动之后,初始化过了,再设置 locale 也不会重新初始化那些对象。 另一种办法是往...

View Article


Image may be NSFW.
Clik here to view.

小程序(1)―― 内网扫描工具

这是一个搭配 reGeorg 工具使用的内网扫描脚本。 当我们利用weshell做代理内网渗透时,reGeorg是一个常用的手段。windows下reGeorg搭配proxifier,能够访问webshell所在的内网机器。 简单说下 reGeorg使用 : 将对应的tunnel脚本上传到webshell服务器后,在本机运行reGeorgSocksProxy.py做代理,-p 设置端口...

View Article


Python内置函数(10)――chr

英文文档: chr ( i ) Return the string representing a character whose Unicode code point is the integer i . For example, chr(97) returns the string 'a' , while chr(8364) returns the string '' . This is the...

View Article

Image may be NSFW.
Clik here to view.

Python Locust性能测试框架实践

python Locust性能测试框架实践 3小时前来源:cnblogs Locust的介绍Locust是一个python的性能测试工具,你可以通过写python脚本的方式来对web接口进行负载测试。Locust的安装首先你要安装python2.6以上版本,而且有pip工具。之后打开命令行,分别安装locustio和pyzmq(命令如下): pip install locustio pip...

View Article

MicroPython 教程

1: 如果你的OpenMV镜头变脏,请使用超细纤维布沾取异丙醇擦拭。 2: 连接到您的OpenMV。使用在IDE中helloworld.py脚本来帮助。 3: 对于windows,请参阅文件首页的设置指南链接。 4: 对于Mac,我们没有开发IDE,只是目前还没有,我们会生成一个后我们完成的文档。或者,您可以安装适用于Mac的开发环境和运行只在自己的IDE(因为它的一个python脚本)。 5:...

View Article

Image may be NSFW.
Clik here to view.

Talk Python to Me: #81 Python and Machine Learning in Astronomy

Episode #81: python and Machine Learning in Astronomy Published Fri, Oct 21, 2016, recorded Fri, Oct 21, 2016. ( embed this episode via SoundCloud ) The advances in Astronomy over the past century are...

View Article


Python内置函数(11)――classmethod

英文文档: classmethod ( function ) Return a class method for function . A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class...

View Article

Image may be NSFW.
Clik here to view.

Opening the BBC micro:bit

As many of you will know, the PSF has been a partner in the British Broadcasting Corporation's (BBC) micro:bit project . A million devices capable of running Micropython have been distributed to every...

View Article


使用python实现短信PDU编码

前几天入手一个3G模块,便倒腾了一下。需要发送中英文混合短信,所以采用PDU模式(不了解google ^_^)。...

View Article

Image may be NSFW.
Clik here to view.

Tiling the plane withPillow

On a recent yak-shaving exercise, I’ve been playing with Pillow , an imaging library for python. I’ve been creating some simple graphics: a task for which I usually use PGF or Ti k Z , but those both...

View Article


Image may be NSFW.
Clik here to view.

Neutron 网络的计算资源隔离与通过 TRex 测试网络性能

好久发博客了,透个气,其实在公司博客写了不少,但短篇为主,今天写了一篇长篇,发出来。 对于 OpenStack 原生的 Neutron 网络,往往诟病良多,核心问题就在性能无法满足生产环境的要求。一般来说,实验室数据往往需要是需求数据的几倍才能平稳、无明显延时的应对用户在真实生产环节下的复杂网络流量。 Neutron 的网络构成非常复杂,以一个典型的 OpenStack...

View Article

Image may be NSFW.
Clik here to view.

5 Things to Know Before Starting Algorithmic Trading

5 Things to know before starting Algorithmic Trading By Milind Paradkar With more than 70% of the trading volumes in the US markets being automated, the rise of the algorithms seem more inevitable than...

View Article

Image may be NSFW.
Clik here to view.

使用 redis-rdb-tools 解析 reids dump.rdb 文件及分析内存使用量

使用 redis-rdb-tools 解析 reids dump.rdb 文件及分析内存使用量 You are here:架构&实践 -性能和可伸缩性 Frank2015/02/13阅读: 1005评论: 0收藏: 0 服务性能 Redis 现在越来越多人开始使用 Redis 了,主要是因为它十分高效、性能强劲、扩展性好。先介绍几种分析 Redis 的工具!-...

View Article
Browsing all 9596 articles
Browse latest View live