Using Python Expressions from C# Code
Utilizing the dynamic features of C# and the Dynamic Language Runtime (DLR), among other things, allows C# programs to interoperate with other dynamic languages built on top of the DLR. For example,...
View Article我不小心删除了所有的数据
昨天,我和在 Famigo 公司的同事 Cody 和 Shaun 一起去参加 MongoDallas 研讨会。我们在几个月前听说了这个会议,感到去这个会议将会是次有趣的活动。我们公司几乎所有的东西都是存储在MongoDB里的,Cody会在这个会议上做一次演讲介绍我们的使用情况。...
View ArticlePython 自学的日子-- Two day(1)-python环境变量、模块初识及字符类型
(1)、模块 标准模块、第三方模块 初识模块:sys \ os 一般标准库存放路径 C:\Users\Administrator\AppData\Local\Programs\python\Python35\Lib 第三方引用安装库存放路径:C:\Users\Administrator\AppData\Local\Programs\Python\Python35\Lib\site-packages...
View ArticlePython中的绝对路劲和相对路径
1、绝对路径 os.path.abspath("文件名"): 显示的是一个文件的绝对路劲 eg: >>> import os>>> os.chdir("E:\\PycharmProjects\\odycmdb\\odycmdb")>>> os.listdir()['settings.py', 'urls.py', 'wsgi.py',...
View ArticlePython的设计哲学探究
在python shell中输入import this就会在屏幕上打印出来Python的设计哲学,如下: In [25]: import this The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. Simple is better than...
View ArticlePython函数式编程初级学习
函数式编程即函数可以作为参数传入函数,也可以返回函数。 1.高阶函数 函数可以作为参数传入函数。 def add(x,y,f): return f(x)+f(y) 调用add函数add(3,-4,abs) ,结果为7 2.map/reduce def f(x): return x*x map(f,[1,2,3,4,5])...
View Articlewerkzeug源码分析(Debug模块)
flask的debug看起来还是很神奇的,可以在异常页面查看当前调用栈,且能够在当前栈内进行交互式会话用以调试。本文将会从python的REPL进行说明并延伸到flask。看看它的具体实现 基本概念...
View ArticleGoogle App Engine revs up Python 3 support
One after another, the arguments against using python 3 in production keep dropping away. Yesterday, Google consigned another one to oblivion: "But there's no Python 3 support on Google App Engine!"...
View ArticlePython学习笔记――几种数据类型
1. 列表list: python内置的一种数据类型是列表:list,用中括号[]表示。list是一种有序的集合,可以随时添加和删除其中的元素,而且元素的类型不必相同。list可以通过下标来访问,范围从0到 len(name) - 1(len()函数可以获取列表长度)。 1.1 插入 insert(position, element):可以通过下标将元素插入指定的位置,后面的元素会依次序后移一位。...
View ArticleReplicating PHP’s Adler32 hash in Python
If you’ve got to replicate a php hash('adler32', $string) command in python, you may expect to just do this: from zlib import adler32checksum = adler32(string) Unfortunately the values are different,...
View ArticleMastering Python
出版时间:2016.4 官网链接: Packt 下载地址: 百度网盘(PDF) 内容简介: Book Description python is a dynamic programming language. It is known for its high readability and hence it is often the first language learned by new...
View ArticleMastering Python Data Visualization
出版时间:2015.10 官网链接: Packt 下载地址: 百度网盘(PDF+EPUB) 内容简介: Book Description python has a handful of open source libraries for numerical computations involving optimization, linear algebra, integration,...
View ArticleMastering Python High Performance
出版时间:2015.9 官网链接: Packt 下载地址: 百度网盘(PDF+EPUB+MOBI) 内容简介: Book Description Simply knowing how to code is not enough; on mission-critical pieces of code, every bit of memory and every CPU cycle counts,...
View Article一张打折卡引发的精度思考
1. 背景 在验证网商营销平台时, 发现一个奇怪的打折卡 经排查, 服务端返回的是打折卡额度分别是 0.39, 0.49, 前端数值乘以 10 进行展示, 0.39 * 10 = 3.9000000000000004 , 在浏览器演示如下: 很明显是 javascript 浮点运算精度问题, 那么为什么两个运算结果一个正常, 一个这么不正经呢? 2. python 分析 Javascript 和...
View ArticleThink Python : 3.3 数学相关函数
python有一个数学模块,它提供了绝大多数常见的数学函数。模块(module)是一个包含了一组相关函数的文件。 在使用模块之前,我们必须导入它: >>> import math 这个语句创建了一个名称为math的 模块对象 。如果你打印这个模块对象,你可以得到一些关于它的信息: >>> print math <module 'math'...
View Articlescrapy爬虫学习【一】之wooyun白帽子精华榜
1.分析 wooyun白帽子一共两千多名,白帽子信息的链接如下: wooyun白帽子 它分为精华榜,人气榜以及贡献榜;三个榜单数据是一样的,只是排名顺序不一样。这里选取 精华榜 作为数据来源。 精华榜的链接为 http://wooyun.org/whitehats/do/1/page/n 可提取信息为 注册日期 , 昵称 , 等级 , 精华漏洞数 , 精华比例 , wooyun主页 手动爬取...
View Articlescrapy爬虫学习【二】之自动爬取
Spider爬取过程 以初始的URL初始化Request,并设置回调函数。当该request下载完毕并返回时,将生成response,并作为参数传递给该回调函数。 spider中初始的request是通过调用 start_requests() 来获取的。 start_request() 读取 start_urls 中的URL,并以 parse 为回调函数生成 Request 。...
View ArticleThink Python : 3.4 组合
目前为止,我们已经分别看过了程序的基本要素――变量,表达式,以及语句。但还没有说如何组合这些基本要素。 编程语言的特性中最有用的一种特性是编程语言 组合 小代码块的能力。例如,函数参数(argument)可以是任何一种表达式,包括算术运算符: x = math.sin(degrees / 360.0 * 2 * math.pi) And even function calls: x =...
View ArticleTalk Python to Me: #71 Soft Skills: The software developer's life manual
Episode #71: Soft Skills: The software developer's life manual Published Thurs, Aug 11, 2016, recorded Wed, Aug 10, 2016. ( embed this episode via SoundCloud ) Writing good, clean code and having a...
View ArticlePython程序员糟糕的一天
python程序员糟糕的一天!! 第一张图是上午上班前,第二张图是下午下班前,一天下来就加了一个return! 为了方便你们看懂具体(主要)的改动,我加了第三张图(上班前)和第四张图(下班前)。 第一张图(因图片显示不完整而看不清楚的,请在“在新标签页中打开图片”): 第二张图: 第三张图: 第四张图: 上班前代码: #!/usr/bin/python # encoding: utf-8 # -*-...
View Article