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

Image may be NSFW.
Clik here to view.

鸭子类型

WIKI讲鸭子类型 已经很清晰了,我接触这个概念是在看雨痕大神的 《Go语言学习笔记》 一书得来的,作者再讲 Golang的接口类型 说就是Duck type。 图片来源: 嘎嘎叫的小狗――快乐的鸭子类型 如下代码实现go的接口 package main import ( "fmt" ) type User struct { name string age byte } type Manager...

View Article


500 lines or less 中文翻译计划

500LineorLess_CN 500 line or less 中文翻译计划。 原文链接 英文项目地址 在翻译过程,发现部分文章有译者已经完成,该部分将不再翻译,并在下列表格中给出链接。 对应表 英文标题 作者 中文标题 Blockcode: A visual programming toolkit Dethe Elza Blockcode:可视化编程工具 A Continuous...

View Article


Marcos Dione: the-truth-about-bool-in-Python

I was trying to modify ayrton so we could really have sh [1]-style file tests. In sh , they're defined as unary operators in the -X form[2], where X is a letter. For instance, -f foo returns true ( 0...

View Article

Image may be NSFW.
Clik here to view.

Election 2016: Tracking Emotions with R and Python

Temperament has been a key issue in the 2016 presidential election between Hillary Clinton and Donald Trump, and an issue highlighted in the series of three debates that concluded this week....

View Article

Python 项目的配置管理

每次开始一个新的 python 项目,我都会为怎么管理配置文件而头疼。不过在迁移我的博客时,终于有空花了点时间,把这件事想清楚。 一年多的时间过去了,一切似乎都很顺利,连我在知乎所做的新项目也沿用了该方案,于是决定把解决方案记录下来。 先说说我要解决什么哪些问题吧: 可以区分各种环境。 在开发、测试和生产等环境,都可能用到不同的配置,所以能区分它们是一个很基本的需求。 可以有通用的配置项。...

View Article


Differential Language Analysis ToolKit

Differential Language Analysis ToolKit DLATK is an end to end human text analysis package, specifically suited for social media and social scientific applications. It is written in python 3 and...

View Article

Image may be NSFW.
Clik here to view.

Production debugging the easy way, with Stackdriver Debugger GA

When it comes to cloud-based applications, traditional debugging tools are slow and cumbersome for production systems. When an issue occurs in production, engineers inspect the logs and try to...

View Article

Python性能分析器Profile

在使用python进行开发的过程中,有时候我们需要对Python程序的执行性能进行分析,此时我们就需要用到Python的性能分析工具,这里我就简单说说Python中的profile和pstats库。 下面是一个测试程序 import osdef a(): sum = 0 for i in range(1, 10001): sum += i return sumdef b(): sum = 0 for...

View Article


Image may be NSFW.
Clik here to view.

Python实例之不掉地的小车制作演示

现在无线控制已经成为了电子科学领域的主流,这次就来教大家做一个主流中的主流 无线控制的小车,先给大家看一下最终的成品演示视频: 首先介绍一下需要用到的材料: TPYBoardv102开发板两块 小车底盘一个 LORA无线模块两块 充电宝一个 9014三极管两个(为什么用到它呢,后面再说)。...

View Article


Stories in My Pocket: New python web app not working?

How many times have you had the thrill of releasing a new service or app to the world, only to have it crashing down when you test the URL and find a server error page instead of your work? Here are a...

View Article

Python内置函数(12)――compile

英文文档: compile ( source , filename , mode , flags=0 , dont_inherit=False , optimize=-1 ) Compile the source into a code or AST object. Code objects can be executed byor. source can either be a normal...

View Article

Image may be NSFW.
Clik here to view.

Scrapy 1.2.1 发布,web 爬虫框架

Scrapy 1.2.1 发布了。 Scrapy 是一套基于基于Twisted的异步处理框架,纯python实现的爬虫框架,用户只需要定制开发几个模块就可以轻松的实现一个爬虫,用来抓取网页内容以及各种图片。 更新内容: 新功能 New FEED_EXPORT_ENCODING setting to customize the encoding used when writing items to a...

View Article

Implementing Stream Keys with nginx-rtmp and Django

Any live video streaming community needs the ability for streamers to publish streams to a private endpoint but have their stream play back on their public profile or channel. This is typically...

View Article


python 的 decorator 学习

最近学习了一下 python 的 decorator(装饰器),看的是这篇, Python修饰器的函数式编程 , 觉得挺有意思的,写点东西记录一下。 装饰器简单讲就是返回一个函数的函数/类。看个简单的例子。 #!/usr/bin/python # -*- coding: utf-8 -*- defdec1(fn): print('inside dec1') defwrapper():...

View Article

Image may be NSFW.
Clik here to view.

Pyspider 框架学习时走过的一些坑

背景:自己在做一个 V2EX 爬虫的时候,需要把爬取的帖子中的内容( title 和 content)保存在本地数据库。 环境:Pycharm 2016.1 + mysql 5.7 + Pyspider + MySQL workbench + python 2.7 32位 1. windows下安装MySQLdb出现的问题及其解决方法 你有两个选择: 安装已编译好的版本(一分钟)...

View Article


Image may be NSFW.
Clik here to view.

Pyspider框架 ―― Python爬虫实战之爬取 V2EX 网站帖子

背景: PySpider:一个国人编写的强大的网络爬虫系统并带有强大的WebUI。采用python语言编写,分布式架构,支持多种数据库后端,强大的WebUI支持脚本编辑器,任务监视器,项目管理器以及结果查看器。在线示例: http://demo.pyspider.org/ 官方文档: http://docs.pyspider.org/en/latest/ Github :...

View Article

Image may be NSFW.
Clik here to view.

Creating low contrast wallpapers withPillow

In mylast post, I explained how I’d been using Pillow to draw regular tilings of the plane. What I was actually trying to do was get some new desktop wallpapers, and getting to use a new python...

View Article


MicroPython 1.8.5 发布,轻量级 Python 3 实现

Micropython 1.8.5 发布,该版本主要是加入了对Zephyr Project的支持(Zephyr Project是一个开源的RTOS)。 py core: - asmthumb: flush D-cache, and invalidate I-cache on STM32F7 - makeqstrdefs.py: use python 2.6 syntax for set...

View Article

Python内置函数(13)――complex

英文文档: class complex ( [ real [, imag ] ] ) Return a complex number with the value real + imag *1j or convert a string or number to a complex number. If the first parameter is a string, it will be...

View Article

Image may be NSFW.
Clik here to view.

Python框架、库以及软件资源汇总

转自: http://developer.51cto.com/art/201507/483510.htm 很多来自世界各地的程序员不求回报的写代码为别人造轮子、贡献代码、开发框架。开放源代码使得分散在世界各地的程序员们都能够贡献他们的代码与创新。 python...

View Article
Browsing all 9596 articles
Browse latest View live