Quantcast
Browsing all 9596 articles
Browse latest View live

[原]Python性能分析器Profile

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

View Article


Vasudev Ram: Count line frequencies with OrderedDict in Python

By Vasudev Ram python programs to count the frequencies of words in a string or from a file are used as common examples. They are often done using dicts. Here is a small program that counts the...

View Article


django api version with decorator

API Versioning Ways 关于 best practices for api versioning 的讨论已经有很多了, Lexical Scope 列举了很多国外知名网站如何实现web api versioning的。 为了支持服务器的多版本API,需要在请求中植入api版本号,添加版本号的方式大体分为两种: 修改url,包括直接修改 url...

View Article

基本排序算法的Python实现

本篇主要实现九(八)大排序算法,分别是冒泡排序,插入排序,选择排序,希尔排序,归并排序,快速排序,堆排序,计数排序。希望大家回顾知识的时候也能从我的这篇文章得到帮助。 为了防止误导读者,本文所有概念性内容均截取自对应Wiki 冒泡排序 原理 冒泡排序(Bubble...

View Article

Image may be NSFW.
Clik here to view.

tryexceptpass: A Python ate my GUI ― Part 3: Implementation

Time to Bootstrap your D3, pick up that python and hop on the Autobahn If you aren’t aware of my earlier posts, check outPart 1 andPart 2 of this series so that you get some context for this ongoing...

View Article


循序渐进Python3(六) -- 面向对象

python 面向对象 什么是面向对象编程? 面向对象编程是一种程序设计范式 对现实世界建立对象模型 把程序看作不同对象的相互调用 Python从设计之初就已经是一门面向对象的语言,正因为如此,在Python中创建一个类和对象是很容易的。下面我们将详细介绍Python的面向对象编程。...

View Article

Python 入门学习之数据类型、字符串、运算符

最近开始学python,这是一个很强大和便捷的编程语言,日后进行科学计算和科研的时候必然成为主要的编程语言。 本来买了一本Python基础教程(第2版),然而教学顺序不太喜欢,因为一开始并没有讲清楚语法,不能学了立马用到实验中。并且,这本书针对的是没有编程基础的人,讲的比较浅。 Python基础教程(第2版)高清晰PDF+源代码 下载...

View Article

Image may be NSFW.
Clik here to view.

[Django_1_1]第一个app

Django 第一个app 本篇负责介绍添加第一个Django app。 关于App和Project 简单的来说,一个项目(Project)可以由很多个应用(App)组成 也就是说: Project > App 创建App 使用命令 python3 manage.py startapp polls ,来创建一个名字为 polls 的App,此时文件结构如下: [root@guoyunzhe...

View Article


PyCharm 2016.1.3 RC 发布,Python 集成开发环境

PyCharm 2016.1.3 RC 发布了,PyCharm是由JetBrains打造的一款python IDE。 一些值得关注的内容: Intelligent Editor: for Python with code completion, on-the-fly syntax and error highlighting and code inspections Code...

View Article


AST transformations with __future__-like module

Inthe previous article I wrote how-to add partial application with ... and piping with @ using AST transformations. However we needed to transform AST manually. For automatizing it I planned to use...

View Article

Building Boost.Python with a custom Python3

I’ve started working on porting some python libraries to Python3, but I required using an old Visual Studio (2012) for which there is no Python3 version. In the end, I tried following this tutorial ....

View Article

[Python]-3-字符串基础

引言 这篇文章介绍python中字符串的基础操作,包括三种字符串的表达方式,字符串连接,转义字符的使用,占位符的使用。 文章目录 0×1.如何输出字符串 python内置的print()函数用于在屏幕上打印字符串,字符串被包含在这个函数的中括号中,可以使用三种引号包含字符串,请看下面的实例: #以下代码在idle3中执行 #1.使用单引号包含字符串 >>>...

View Article

Image may be NSFW.
Clik here to view.

学习 Python 编程的5个最佳资源,洪荒之力一触即发!

用python编写代码一点都不难,事实上它一直被赞誉为最容易学的编程语言。如果你准备学习web开发, Python是一个不错的开始,甚至想做游戏的话,用Python来开发游戏的资源也有很多。这是快速学习这门语言的途径之一。...

View Article


Python学习笔记4――高级特性

1. 切片(Slice) 类似于php的substr, 取到哪里并不包括那一个,比如L[0:3]表示,从索引0开始取,直到索引3为止,但不包括索引3。 [哪里开始取:取到哪里] [哪里开始取:取到哪里:每几个取一个] [:] 原样复制 list,tuple,string都可以用切片;原来是什么类型,取了之后就是什么类型 2. 迭代(Iteration) 用for循环 for...in: ......

View Article

Image may be NSFW.
Clik here to view.

Codementor: Python Optimization: How it Can Make You a Better Programmer

Codementor python expert and Stack Overflow legend Martijn Pieters joined us for an Office Hour session to give us a quick tutorial about Python optimization. The text below is a summary done by the...

View Article


[Python]-4-数值与运算

引言 这篇文章介绍python中三种十分常用的数值数据类型,并使用这些数据类型演示一些简单的计算。 文章目录 0×1.如何判断数据类型 python中可以使用type()函数来判断变量是什么数据类型,type()函数会返回一个type值,请看下面的实例: #创建四个变量引用,分别赋值为整数,字符串,浮点数与虚数 >>> a=1 >>>...

View Article

Image may be NSFW.
Clik here to view.

Tutorial: Using PySpark and the MapR Sandbox

PySpark is a Spark API that allows you to interact with Spark through the python shell. If you have a Python programming background, this is an excellent way to get introduced to Spark data types and...

View Article


Marcos Dione: ayrton-0.8-Home-Sweet-New-Home

Long time for this release. A couple of hard bugs (which fix was just moving a line down a little), a big-ish new feature, and moving in a new city. Here's the ChangeLog : You can import ayrton...

View Article

Use FragmentOnBonds to fragment a molecule in RDKit

[| next ] ////////fragment_on_bonds Use FragmentOnBonds to fragment a molecule in RDKit This is part of a continuing series on how to fragment a molecular graph. So far I have covered: Molecular...

View Article

Image may be NSFW.
Clik here to view.

Introducing Scrapy Cloud with Python 3 Support

It’s the end of an era. python 2 is on its way out with only a few security and bug fixes forthcoming from now until its official retirement in 2020 . Given this withdrawal of support and the fact...

View Article
Browsing all 9596 articles
Browse latest View live