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

Image may be NSFW.
Clik here to view.

利用Python爬虫给孩子起个好名字

前言相信每位家长都有所体会,因为要在孩子出生后两周内起个名字(需要办理出生证明了),估计很多人都像我一样,刚开始是很慌乱的,虽然感觉汉字非常的多随便找个字做名字都行,后来才发现真不是随便的事情,怎么想都发现不合适,于是到处翻词典、网上搜、翻唐诗宋词、诗经、甚至武侠小说,然而想了很久得到的名字,往往却受到家属的意见和反对,比如不顺口、和亲戚重名重音等问题,这样就陷入了重复寻找和否定的循环,越来越混乱。...

View Article


python 出现SyntaxError: non-keyword arg after keyword arg错误解决办法

python 出现SyntaxError: non-keyword arg after keyword arg错误解决办法前言:      在Python中,这两个是python中的可变参数,*arg表示任意多个无名参数,类型为tuple,**kwargs表示关键字参数,为dict,使用时需将*arg放在**kwargs之前,否则会有“SyntaxError: non-keyword arg...

View Article


让python 3支持mysqldb的解决方法

前言在新的一年里祝大家前端都用ES6,php都用PHP7,Java都是JAVA9,python都是3。好了,下面进入本文的主要的内容,大家可能在python2.x中用习惯了mysqldb,但是在python3.x中已经不支持那个组件了。如果还想要让python 3支持mysqldb该怎么办呢?下面来一起看看吧。原因MySQLdb 只适用于python2.x,发现pip装不上。它在py3的替代品是:...

View Article

python用装饰器自动注册Tornado路由详解

第一个版本在这个版本中,首先创建了 RouterConfig 对象,其构造方法创建了 tornado.web.Application() 并赋值为 self.Application ,在每个 Handler 上添加 @app.route 装饰器,对应的就是 RouterConfig 下面的 route 对象,其中 Handler 实例会被赋值到 handler 参数中,最后把 URL 和...

View Article

利用python程序生成word和PDF文档的方法

一、程序导出word文档的方法将web/html内容导出为world文档,再java中有很多解决方案,比如使用Jacob、Apache...

View Article


Image may be NSFW.
Clik here to view.

初学者最容易学的六种编程语言

初学者最容易学的六种编程语言 2小时前来源:51CTO 【51CTO.com快译】学习编程看起来是一项艰巨的任务,其实不如想象中的那么难学。由于,现在网上有一大批资源可供使用和活跃的社区,以及社交媒体上也有很多专家,现在学习编程要比过去简单得多,就连小孩子都能尽快的学习编程了。 然而,学编程关键是要找到一种合适的语言。下面是为大家介绍初学者,最容掌握的六种编程语言。 1.javascript...

View Article

Image may be NSFW.
Clik here to view.

面试 | 很全的 Python 面试题(二)

面试 | 很全的 python 面试题(二) 一点号书圈13小时前 热文导读 | 点击标题阅读 博士和局长上厕所,故事很短,意味深长! 普通本科出身的名校研究生:我们为何沦为学渣? 本、硕、博区别的“兔子理论” 耶鲁大学校长:如果学生从大学毕业后拥有了某种专业的知识和技能,这将是耶鲁教育最大的失败! php?url=0FpIL9Hlbv" alt="面试 | 很全的 Python 面试题(二)"...

View Article

Debugging Django production issues

From time to time, I run into a problem that only occurs in a production-like Django setup ( DEBUG off, running under gunicorn, static asset compression in play, and so on). Debugging such issues on a...

View Article


常用Python日期、日志、获取内容循环的代码片段

近段时间对shell脚本和python进行了梳理,将一些脚本中常用的内容,考虑多种方法整理出来,形成有用的代码片段,这样就可以在需要的时候直接使用,也可以用于备忘和思考。 本次整理的代码片段有: python中日期、时间常用获取方法; 记录处理日志的logging模块使用;从目录,文件,命名结果中,获取循环条件进行循环。 我将这些有用的代码片段整理在一个Python脚本中了,并且测试可用。...

View Article


Image may be NSFW.
Clik here to view.

[原]卷积是什么?

在泛函分析中,卷积、旋积或摺积(英语:Convolution)是通过两个函数f和g生成第三个函数的一种数学算子,表征函数f与g经过翻转和平移的重叠部分的面积。如果将参加卷积的一个函数看作区间的指示函数,卷积还可以被看作是“滑动平均”的推广。 卷积公式: 相关运算过程:...

View Article

Image may be NSFW.
Clik here to view.

Two new short courses in Calgary

We're running two one-day courses in Calgary for the CSPG Spring Education Week . One of them is a bit... weird, so I thought I'd try to explain what we're up to. Both classes run from 8:30 till 4:00,...

View Article

Image may be NSFW.
Clik here to view.

Using the Requests Module in Python

Requests is a python module that you can use to send all kinds of HTTP requests. It is an easy-to-use library with a lot of features ranging from passing parameters in URLs to sending custom headers...

View Article

Image may be NSFW.
Clik here to view.

漫画喵的100行Python代码逆袭

漫画喵的100行python代码逆袭 一点号编程派昨天 小喵的唠叨话:这次的博客,讲的是使用python编写一个爬虫工具。为什么要写这个爬虫呢?原因是小喵在看完《极黑的布伦希尔特》这个动画之后,又想看看漫画,结果发现各大APP都没有资源,最终好不容易找到一个网站可以看,但是由于网速太渣,看起来额外的费劲。这时候如果能提前下载下来就好了。...

View Article


Image may be NSFW.
Clik here to view.

上传并发布你自己发明的轮子 - Python PyPI 实践

本文仅讨论上传相关的步骤,关于如何给写一个 setup.py 请参阅官方文档: https://docs.python.org/2/distutils/setupscript.html 上传前的注意事项 假设你的包已经开发完成,并且根目录必须要有一个 setup.py 。 最好有一个 README.rst 用来描述你的轮子,虽然这不是必须的,但文档就像内裤,你最好还是要有的。...

View Article

Image may be NSFW.
Clik here to view.

Python Matrices

I’ve been using the python programming language increasingly often over the past few months, mostly because two powerful machine learning libraries ― Google’s TensorFlow and Microsoft’s CNTK ― have...

View Article


PyCharm 2017.1 EAP 10 (build 171.3780.17)

This week we’re releasing the last, but not the least, EAP for PyCharm 2017.1.Get the EAP now. We’ve resolved many bugs, including: Virtualenvs are now created with pip 9.0.1 and setuptools28.8.0 The...

View Article

Image may be NSFW.
Clik here to view.

Django-Classifier or What Have I Done?

From time to time you have to build some properties for an object and usually those are just a bunch of fields for a model. With django-classifier you may do that in another way. It allows you to...

View Article


Image may be NSFW.
Clik here to view.

使用 Python Twistd 搭建反向代理服务器

Nginx ("engine x") 是一个高性能的HTTP和反向代理服务器。我们今天搭建一个类似 Nginx 的反向代理服务器,使用的是 python 里面的 Twistd 框架。...

View Article

Image may be NSFW.
Clik here to view.

How to Write a Collectd Plugin with Python

This post was originally published here Collectd is a system statistics collection daemon. It gathers a lot of information about the system it’s running on, and passes it on to a software that can...

View Article

Python raw sockets sniffing & pcap saving

Even though we are pretty used to it, libpcap is not always present on systems. Usually, regardless of your goal, looking at traffic is actually pretty useful. In my experience this applies to...

View Article
Browsing all 9596 articles
Browse latest View live