python之路四
1. abs(x) abs()函数返回数字(可为普通型、长整型或浮点型)的绝对值。如果给出复数,返回值就是该复数的模。例如: >>>print abs(-2,4) 2.4 >>>print abs(4+2j) 4.472135955 2. apply(function,args[,keywords])...
View Article0 to Life-Changing App: Viewing Images with Python 3 and OpenSlide
500 Images at around 7GB each. That's a lot of data. Not sure what I am referring to? Let me fill you in. Not too long ago I was assigned the project of my dreams here at IBM's Spark Technology Center:...
View ArticlePython Day4
本章内容: 1.高阶函数和嵌套函数回顾 2.装饰器 3.生成器 4迭代器 什么是高阶函数? 高阶函数代表函数作为一个值来进行调用,也称为函数调用函数 def bar(): print("123")def func(d): print("hello ")func(bar()) 什么是嵌套函数? 嵌套函数就是指的函数套函数 def bar(): def func(): print("hello")...
View ArticlePatterns are half-formedcode
If “technology is stuff that doesn’t work yet”, then patterns are code we don’t know how to writeyet. In the Go Programming Language , the authors show how to iterate over elements in a map, sorted...
View Article[Python]-7-决策循环与异常处理
引言 这篇文章介绍python中的流程控制与异常处理。 文章目录 0×1.使用if做出决策 python的if语句与其他编程语言最大的区别解释每个分支后面都需要添加一个说明号,请看下面的实例: #!/usr/bin/env python3 #coding=utf-8 try: a=input("请输入整数0:") if int(a)==0: print("www.qingsword.com")...
View Article[译] 一个模板引擎是如何工作的?
原文: How a template engine works 我已经使用模板引擎很长一段时间了,现在终于有时间来了解一下模板引擎是如何工作的。 概述 简单地说,模板引擎是一个工具,你可以用它来进行涉及到很多的文本数据的编程任务。最常见的用法是Web应用程序中的HTML生成。尤其是在python中,如果你想要使用一个模板引擎,那么现在我们有几种选择,例如 jinja 或者 mako...
View ArticlePython学习--xlwt框架操作excel表格
经常我们用爬虫从网页上面爬取下来一些数据,想要进行分析或者统计等用途。如果能将数据写入excel表格中,那是在好不过了?为了实现这个需求。。。。故而特地写了文章来记录将数据写入excel表格中的爬虫程序。 具体代码: #coding:utf8 ''' Created on 2016年8月12日 @author: Hanrovey ''' import xlwt from datetime...
View ArticleMac+Eclipse 安装BeautifulSoup4
一、安装python sudo rm -rf /System/Library/Frameworks/Python.framework/ sudo rm -rf /Library/Frameworks/Python.framework/ sudo rm -rf /Applications/Python\ 2.7/ sudo rm -rf /usr/local/bin/* 重启机器...
View Article自动化系列四之Python函数
python自动化 时间:2016.08.09 笔者QQ:572891887、552408925 linux架构交流群:471443208、524721466 1.1Python函数 面向对象 面向过程 1.可读性差 2.重用性差 函数式编程 1.1.1自定义函数 看一个函数的例子:db文件内容为 xuliangwei|123 deflogin(username,password): '''...
View Article[Python]-8-函数
引言 这篇文章介绍python中函数的基本知识。 文章目录 0×1.自定义函数 在任何编程语言中,函数的作用都是相同的,它可以将一些需要重复执行的语句组合起来,方便在需要的时候调用他们,python中使用def关键字来创建一个函数,请看下面的实例: #!/usr/bin/env python3 #coding=utf-8 dect={"one":1,"two":2,"three":3}...
View ArticleSet And Forget Python Script To Monitor Offline Site
I've just had a clients site go offline due to a server change, it was a quick move, so no big deal, however, I wanted to check the status of the site to see when it came back online but without having...
View ArticleEp. 101 Open Sourcerer of Django (Jacob Kaplan-Moss)
Source: http://codenewbie.org Jacob Kaplan-Moss is often credited for co-creating Django, one of the most popular web frameworks written in python. But that’s not exactly true. He’s also given credit...
View ArticlePython for Programmers (new book)
I've done it again, I've written another book. OK so it's a short one, but it's been really enjoyable as it's been mainly me documenting my experience as a programmer learning a new language and all...
View ArticlePython黑帽编程2.9 面向对象编程
python 黑帽编程 2.9 面向对象编程 我个人认为,计算机语言的发展,有两个方向,一个是从低到高的发展过程,在这个过程中,语言的思考和解决问题的方式是面向硬件的。硬件本质上处理的是信号,在此基础上,我们给硬件赋予了一定的“逻辑思维”能力,为了方便硬件帮我们做事,抽象出了指令的概念,进而出现了汇编语言,然后有了 Pascal 和 C...
View Articlepython的历史
python的诞生 Python的创始人吉多范罗苏姆(Guido van Rossum),在1989年12月的圣诞节期间,为了打发时间,决定开发一种新的脚本解释程序,作为ABC语言的继承。 现在,python以其优美,清晰,简单的特性在全世界广泛流行,成为最主流的编程语言之一。...
View Article一文学会Python多线程编程
一文学会python多线程编程 一点号编程派4小时前 编 本文作者为 Michael Driscoll,是其新书 Python 201 的一节。本文译者为 linkcheng,由EarlGrey@编程派校对。 译者简介:linkcheng,专业电子信息工程。已有两年工作经验,从事 c/c++ 开发。目前在学习 flask,希望以后自己可以搭建网站。 Threading模块从 Python 1.5.2...
View Article程序员带你十天快速入门Python,玩转电脑软件开发(二)
程序员带你十天快速入门python,玩转电脑软件开发(二) 一点号CSharp自学4小时前 声明:本次教程主要适用于已经习得一门编程语言的程序员。想要学习第二门语言。有梦想,立志做全栈攻城狮的你 如果是小白,也可以学习本教程。不过可能有些困难。如有问题在文章下方进行讨论。或者添加QQ群538742639。群马上就满了,名额不多。 上节课主要讲解了以下内容: 为什么学习Python?...
View ArticlePython基础系列----函数,面向对象,异常
python基础系列----函数,面向对象,异常 1小时前来源:cnblogs 1.前言 前面讲了一些关于python的一些基本的语法及语句,在这个地方继续讲python的方法及其python核心概念的面向对象。我们都知道python被称为面向对象的语言,那么在这里我们将正式的接触 的python的核心。 2.函数...
View ArticleMarcos Dione: interesting-pycon-talks
Like I said in my last post[1], I'm looking at last PyCon 's videos . Here are my selected videos, in the order I saw them: Ned Batchelder - Machete-mode debugging: Hacking your way out of a tight spot...
View Article