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

机器之心深度研学社每周干货:2017年第1周

Synced 深度研学社每周干货,每周五为大家推荐机器学习的入门教程、技术分析、以及资源分享。不多不少,每周进步一点点 ~ 【入门书籍】 Speech and Language Processing by Daniel Jurafsky, James H. Martin 简介:作者 Daniel Jurafsky是斯坦福大学语言学系和计算机系的教授,James H....

View Article


Django中null和blank的区别

Django的Model可以设置字段的null属性和blank属性。 null属性是针对数据库而言的,null=True将设置数据库的COLUMN为NULL(或者NOT NULL),而blank为True将不会影响数据库的结构,依然是必填。但是在Django里面,是可选的。即Form不会是required,Django自带的admin页面不要求必填了。 具体作用到数据库,是这样: class...

View Article


Image may be NSFW.
Clik here to view.

谷歌发布新项目,旨在将Python代码编译为Go

谷歌发布新项目,旨在将python代码编译为Go 5小时前来源:51CTO 【51CTO.com快译】Python很可能遭遇另一位强劲的编程语言对手:谷歌Go。 作为一项实验性项目,谷歌公司的Grumpy能够将Python代码转换为Go形式,这意味着Python程序将能够在编译后利用Go工具链作为静态二进制文件运行。其对Python的转换相当于创建了一款Go应用。...

View Article

Image may be NSFW.
Clik here to view.

Python高手之路【五】python基础之正则表达式

下图列出了python支持的正则表达式元字符和语法: 字符点:匹配任意一个字符 import re st = 'python' result = re.findall('p.t',st) print(result) 字符^:匹配以什么开头 import re st = 'python' result = re.findall('^py',st) print(result) 字符$:匹配以什么结尾...

View Article

Image may be NSFW.
Clik here to view.

Andrlid 编译神器Freeline

工欲善其事必先利其器。 随着我们开发的项目功能越来越多,我们的项目的体积也会越来越大,相对应的我们运行我们的项目的时候编译的速度也会越来越慢。就比如我现在的项目,每次改完一个地方后,重新运行都需要50多秒,这还是在我的电脑是固态硬盘,16G运行内存的前提下的时间。真是相当的痛苦。所以当有一个比较复杂的效果开发的时候我都是先写一个小demo调的差不多的时候在集成到项目中。...

View Article


【Python】Pandas Dataframe转json

pandas是python里一个高效的数据处理库,在web开发中,有时候需要读取本地数据返回给前端,返回给前端的一般是json数据。pandas通过函数 to_json() 直接json转化的能力。 下面是函数说明: DataFrame.to_json ( path or buf=None, orient=None, date_format='epoch',...

View Article

Python高手之路【六】python基础之字符串格式化

python的字符串格式化有两种方式:百分号方式、format方式 百分号的方式相对来说比较老,而format方式则是比较先进的方式,企图替换古老的方式,目前两者并存。[ PEP-3101 ] This PEP proposes a new system for built-in string formatting operations, intended as a replacement for...

View Article

Image may be NSFW.
Clik here to view.

自动打Tag杂记

给一段文字标记 Tag 是一个很常见的需求,比如我每篇博客下面都有对应的 Tag,不过一般说来,Tag 是数据录入者人为手动添加的,但是对大量用户产生的数据而言,我们不能指望他们能够主动添加合适的 Tag,于是乎就产生了这样的需求:自动打 Tag。 实际上这已经属于 NLP 高大上的范畴了,不是我这种非科班出身的人所能掌控的。好消息是 百度 和 腾讯 都有 NLP 平台可供选择,坏消息是免费版的...

View Article


Image may be NSFW.
Clik here to view.

Programming Games in Python

Although not the most famous facet of python, Python is a language with has enough possibilities for programming games in python.On the one hand, it combines the depth and resources of using C / C ++...

View Article


How a Python Script Can Launch a Clojure Application

If you ever need a python Script that starts a Clojure application, do something else and then stops the application then this post is for you. The script below considers that you have a Clojure...

View Article

Image may be NSFW.
Clik here to view.

Matplotlib 中文用户指南 3.1 pyplot 教程

3.1 pyplot 教程 原文: Pyplot tutorial 译者:飞龙 协议: CC BY-NC-SA 4.0 matplotlib.pyplot 是一个命令风格函数的集合,使 matplotlib 的机制更像 MATLAB。 每个绘图函数对图像进行一些更改:例如,创建图像,在图像中创建绘图区域,在绘图区域绘制一些线条,使用标签装饰绘图等。在 matplotlib.pyplot...

View Article

Image may be NSFW.
Clik here to view.

突破旧思维

突破旧思维 2017.01.07 21:00:59 两则python方面的例子。 第一则。看了不少别人的代码,发现大量Python程序员习惯这么取List里的数据: lst = [['张三丰', '太极拳', '武当派', ['男', 60]], ['越阿青', '越女剑', '无门派', ['女', 15]], ['凌未风', '大须弥', '天山派', ['男', 48]], ['张无忌',...

View Article

Python中的sort()方法使用基础

一、基本形式 sorted(iterable[, cmp[, key[, reverse]]]) iterable.sort(cmp[, key[, reverse]]) 参数解释: (1)iterable指定要排序的list或者iterable,不用多说; (2)cmp为函数,指定排序时进行比较的函数,可以指定一个函数或者lambda函数,如:...

View Article


Python高手之路【八】python基础之requests模块

1、Requests模块说明 Requests 是使用 Apache2 Licensed 许可证的 HTTP 库。用 python 编写,真正的为人类着想。 Python 标准库中的 urllib2 模块提供了你所需要的大多数 HTTP 功能,但是它的 API 太渣了。它是为另一个时代、另一个互联网所创建的。它需要巨量的工作,甚至包括各种方法覆盖,来完成最简单的任务。...

View Article

Image may be NSFW.
Clik here to view.

Christoph Zwerschke: Never iterate a changing dict

Yesterday I noticed a bug in a python program that only appeared when running it with the new Python 3.6. It turned out that the program had been running a slippery slope all the time. Essentially, the...

View Article


Image may be NSFW.
Clik here to view.

Experiments with AO3 andPython

Recently, I’ve been writing some scripts that need to get data from AO3 . Unfortunately, AO3 doesn’t have an API (although it’s apparently on the roadmap ), so you have to do everything by scraping...

View Article

机器视觉:Caffe Python接口多进程提取特征

想象这样一个场景:服务器上配备了很多GPU显卡,而你又使用的是Caffe,不幸的是,你还选用了python来写代码,不幸中的不幸是你还要在短时间内处理百万千万规模的图片。那么,问题来了,Caffe本身对多卡的支持就不是很好,而你还要用Python,而且即便你通过设置batch size的大小来加快处理速度,但你还是只把一张显卡用起来。有没有办法把所有的GPU都用起来,并行提取特征呢?...

View Article


Vasudev Ram: An Unix seq-like utility in Python

By Vasudev Ram Due to a chain (or seq uence - pun intended :) of thoughts, I got the idea of writing a simple version of the Unix seq utility (command-line) in python . (Some Unix versions have a...

View Article

Image may be NSFW.
Clik here to view.

Deploying a Python Website to Azure with Docker

This post will cover how to deploy a python Website to Azure Web Apps for linux using python. With the release of Web Apps for Linux it makes it easier to deploy any application to Azure Web Apps....

View Article

Image may be NSFW.
Clik here to view.

年度盘点(七) | 2016 年十大 Python 开发者必读好文

2016 年已经过去,感谢大家支持开发者头条。 年度盘点第七篇:2016 年十大 python 开发者必读好文。 长按识别文章摘要下方二维码,即可进入文章评论页。 0. Python 的练手项目有哪些值得推荐? 好东西就是用来分享的 https://toutiao.io/posts/oco6pw 1. Python 爬虫学习系列教程 学习总结...

View Article
Browsing all 9596 articles
Browse latest View live