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

设计符合 Python 编程理念的应用编程接口

本文作者为 Noam Elfanbaum,是以色列的一名 python 开发者。本文译者 linkmyth,校对 EarlGrey@编程派。linkmyth 是同济大学的在读硕士,主攻web开发、机器学习等方向。 本文参考了 Kenneth Reitz 的 Requests 库 的 API 设计。 编写软件包(库)时,设计良好的 API 与软件包的功能同样重要(当然,前提是你想让别人使用),那么好的...

View Article


使用 JWT 让你的 RESTful API 更安全

传统的 cookie-session 机制可以保证的接口安全,在没有通过认证的情况下会跳转至登入界面或者调用失败。 在如今 RESTful 化的 API 接口下,cookie-session 已经不能很好发挥其余热保护好你的 API 。 更多的形式下采用的基于 Token 的验证机制,JWT 本质的也是一种 Token,但是其中又有些许不同。 什么是 JWT ? JWT 及时 JSON Web...

View Article


Image may be NSFW.
Clik here to view.

Python 爬虫第一步

正则表达式的使用 想要学习 python 爬虫 , 首先需要了解一下正则表达式的使用,下面我们就来看看如何使用。 . 的使用 这个时候的点就相当于一个占位符,可以匹配任意一个字符,什么意思呢?看个例子就知道 import re content = "helloworld" b = re.findall('w.',content) print b 注意了,我们首先导入了 re...

View Article

Python for Kids: Python 3 Project 7

python for Kids: Python 3 Project7 August 21, 2016 Leave a comment Using Python 3 in Project 7 of Python For Kids For Dummies In this post I talk about the changes that need to be made to the code of...

View Article

python 邮件基础篇

python 操作邮件,不是很方便,说实话还不是理解的特别透彻,这次想把自己碰到的东西总结下来 邮件有imap,pop,imap协议,这次使用的是imap4协议,主要用了imap4和mail类, 代码主要参考了http://blog.csdn.net/bonnshore/article/details/8729984,里面写的很详细,可以实现收发邮件 下面把主要的代码贴一下: 初始化,定义邮件服务器...

View Article


Python网络爬虫5 图片抓取

这一节看下如何抓取网页中的图片。目标网址是: http://pp.163.com/longer-yowoo/pp/10069141.html 。这里有一组我非常喜欢的图片。 要抓取网页首先就要找出图片的网址。这里仍然是使用BeautifulSoup,具体如何使用在前一节《 使用BeautifulSoup解析网页 》时说过,现在就不说了。看下代码好了: #!python # encoding:...

View Article

Take that boredom

While I was bored on Defcon, I took the smallest VPS in DO offering (512MB RAM, 20GB disk), configured nginx on it, bought domain zlatan.tech and cp'ed my blog data to blog.zlatan.tech. I thought it...

View Article

Image may be NSFW.
Clik here to view.

[工具资源] 利器系列 - Web 网络模拟工具,测试应用在低速不稳定网络中的表现

在开发环境中,由于开发者对设备和网络通常是最高标准的要求,用以提高自己的生产效率,会产生灯下黑的情况,开发出的产品在稳定的高速网络下表现优异,这很重要,但要进行换位思考,还需要更上一层楼,Web产品的使用者越来越多的是移动网络,而移动网络的特点就是不稳定以及龟速的GPRS还有很多人在用,为了在开发和测试环境中做到用户环境的网络模拟,我们需要使用一系列工具来帮助我们开发测试更好的Web。...

View Article


Major update drops for popular Pwntools penetration showbag

The third version of the Pwntools exploit showbag has been released, sporting new Android p0wnage functions and a host of additional modules. The python development library is the brainchild of Google...

View Article


Image may be NSFW.
Clik here to view.

Python黑帽编程3.0 第三章 网络接口层攻击基础知识

3.0 第三章 网络接口层攻击基础知识 首先还是要提醒各位同学,在学习本章之前,请认真的学习 TCP/IP 体系结构的相关知识,本系列教程在这方面只会浅尝辄止。 本节简单概述下 OSI 七层模型和 TCP/IP 四层模型之间的对应关系,最后是本章教程需要的几个核心 python 模块。 3.0.1 TCP/IP 分层模型 国际标准化组织( ISO )在 1978...

View Article

Why You Should Learn Python

Introduction My first encounter with python was a part of the introductory course to programming. Well, I actually played with it on my own before, so I already was familiar with its syntax when the...

View Article

Python httplib2 Tutorial HTTP GET/POST Examples

In this tutorial, we show how to work with the python httplib2 module. The Hypertext Transfer Protocol ( HTTP ) is an application protocol for distributed, collaborative, hypermedia information...

View Article

python如何查看线程id

最近使用python多线程程序,发现会耗尽所有的cpu,有必要让python程序运行在一个cpu上.,但是发现threading.get_ident() 返回一个极大的整数,根本和线程号对不上. 只是使用先获取系统调用号 点击( 此处 )折叠或打开 #include < stdio . h > #include < sys / syscall . h > int main (...

View Article


Image may be NSFW.
Clik here to view.

Oldboy-Homework-Week2.2

一、关于python全栈开发第二周所讲内容的回忆(上篇)6.列表(list)、元组(tuple)、字典(dictionary)7.字符串、及其字符串格式化输出8.for循环二、详细内容6.1列表:列表的形式为[1,'a',[i,j]]:可以存放一些数字、字符串、还有列表本身,与字符串的本质区别就在于:列表可存、可取、可操作性!6.1.1列表的切片使用:list1 =...

View Article

Image may be NSFW.
Clik here to view.

Python如何使用PIL生成验证码?

python如何使用PIL生成验证码? 一点号Python实践派昨天 web项目中遇到使用验证码的情况有很多,进行介绍下使用PIL 生成验证码的方法。 安装 开始安装PIL的过程确实麻烦各种问题层出不绝,不过不断深入后就没有这方面的困扰了: windows安装:直接安装Pillow,最好使用编译好的对应版本。...

View Article


Image may be NSFW.
Clik here to view.

Windows7 x64安装numpy和scipy

python借助于numpy和scipy这两个库,在科学计算上也是大有用处的,但问题是这两个库并不好装,尤其是在64位的情况下。 官方Pypi上默认只提供了32位的,而sourceforge上针对windows的exe安装包(貌似)也没有64位的。 我在2.7下直接pip install无法安装numpy,3.4下numpy正常安装,但是scipy却死活安装不上。...

View Article

Image may be NSFW.
Clik here to view.

Python style logging in R

We are increasingly using R in “operational” settingsthat require robust error handling and logging. In this post we describe a quick-and-dirty way to get python style multi-level log files by wrapping...

View Article


Image may be NSFW.
Clik here to view.

Logistic Regression in Python Using Rodeo

What is Logistic Regression? Logistic Regression is a statistical technique capable of predicting a binary outcome. It's a well-known strategy, widely used in disciplines ranging from credit and...

View Article

Image may be NSFW.
Clik here to view.

Micropython 关于 TPYBoard 固件烧写

初识ST-LINK V2 ST- LINK/V2是STM8和STM32微控制器系列的在线调试器和编程器。 单线接口模块(SWIM)和串行线调试(SWD)接口用于与应用板上的STM8和 STM32 微控制器通讯。 STM8的应用使用USB 全速接口与ST Visual Develop (STVD),ST Visual Program(STVP)或 IAREWSTM8 等集成开发环境通讯。 STM32...

View Article

使用Beautiful Soup编写一个爬虫 系列随笔汇总

这几篇博文只是为了记录学习Beautiful Soup的过程,不仅方便自己以后查看,也许能帮到同样在学习这个技术的朋友。通过学习Beautiful Soup基础知识 完成了一个简单的爬虫服务:从allitebooks.com抓取书籍的书名和每本书对应的ISBN码,然后通过ISBN码去amazon.com抓取对应的价格。 第一部分 Beautiful Soup的基础知识 Beautiful...

View Article
Browsing all 9596 articles
Browse latest View live