Quantcast
Browsing all 9596 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

CSAW CTF Qualification Round 2013: Misc 300 Life

0x00 题目 http://en.wikipedia.org/wiki/Conways_Game_of_Life nc 128.238.66.216 45678 0x01 解题 连接服务器后,会显示类似的图案: ##### Round 1: 25 Generations ##### ####################### # * # #* * # # * * # # * ** * ***#...

View Article


[Python]-6-比较运算

引言 这篇文章介绍python中的比较运算,比较运算不仅可以用来比较两个数值数据的大小,还能比较字符串或列表的大小。 文章目录 0×1.比较数值数据 数值数据的比较十分简单,如果表达式为真,就返回True,为假就返回False,请看下面的实例: >>> 1>2 False >>> 1<2 True #比较两个数值数据是否相等的时候,需要使用双等号...

View Article


Image may be NSFW.
Clik here to view.

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

设计符合 python 理念的应用编程接口 一点号编程派3小时前 本文作者为 Noam Elfanbaum,是以色列的一名 Python 开发者。 本文译者 linkmyth,校对 EarlGrey@编程派。linkmyth 是同济大学的在读硕士,主攻web开发、机器学习等方向。 本文参考了 Kenneth Reitz 的Requests 库的 API 设计。 编写软件包(库)时,设计良好的 API...

View Article

yield, async

yield实现斐波那契序列: import sys, timedef fib(): a,b,c = 0,1,0 while True: yield c a,b = b, c c = a + bif __name__ == '__main__': fib_iter = fib() for i in range(int(sys.argv[1])): print(fib_iter.__next__())...

View Article

Make your Python code more readable with custom exception classes

Let’s say we want to validate an input string representing a person’s name in our application. A simple toy example might look like this: def validate(name): if len(name) < 10: raise ValueError If...

View Article


Image may be NSFW.
Clik here to view.

Import Python: ImportPython Issue 86

Worthy Read python Packaging Is Good Now Python packaging is not bad any more. If you’re a developer, and you’re trying to create or consume Python libraries, it can be a tractable, even pleasant...

View Article

Image may be NSFW.
Clik here to view.

用Python解决计数原理问题的方法

前几天遇到这样一道数学题:用四种不同颜色给三棱柱六个顶点涂色,要求每个点涂一种颜色,且每条棱的两个端点涂不同颜色,则不同的涂色方法有多少种?当我看完题目后,顿时不知所措。于是我拿起草稿纸在一旁漫无目的地演算了一下,企图能找到解决方法。结果一无所获。于是打算通过程序算法解决这个问题。经过2个多小时的研究,终于完成了代码,并求得了答案。由于python写起来比较方便而且本人比较喜欢Python的语法,所...

View Article

快速入手Python字符编码

前言对于很多接触python的人而言,字符的处理和语言整体的温顺可靠相比显得格外桀骜不驯难以驾驭。文章针对Python 2.7,主要因为3对的编码已经有了很大的改善并且实际原理一样,更改一下操作命令即可。了解完本文,你可以轻松解决文字处理,特殊平台(windows?)下的编码,爬虫编码等问题。阅读建议本文分为如下几个部分:    1.原理    2.具体操作    3.建议的使用习惯...

View Article


Image may be NSFW.
Clik here to view.

Python采用Django制作简易的知乎日报API

现在我主要教大家如何去实战,做一个简易的知乎日报API 首先你要熟悉django的基本用法,会写模型,会写视图函数,会配置url。1.配置字符编码因为我们等一下要使用中文,所以要先设好字符编码 在settings.py里将LANGUAGE_CODE设为'zh-CN' 然后添加这两行FILE_CHARSET='utf-8'DEFAULT_CHARSET='utf-8'还要进入到数据库 依次输入set...

View Article


Image may be NSFW.
Clik here to view.

利用Python实现图书超期提醒

一、模拟登录图书馆管理系统我们可以先看一下登录页面(很多学校这些管理系统页面就是很low):两种方式去模拟登录图书馆:1....

View Article

Image may be NSFW.
Clik here to view.

Python正规则表达式学习指南

1. 正则表达式基础1.1....

View Article

Image may be NSFW.
Clik here to view.

Python实现SMTP发送邮件详细教程

简介python发送邮件的教程本人在网站搜索的时候搜索出来了一大堆,但是都是说了一大堆原理然后就推出了实现代码,我测试用给出的代码进行发送邮件时都不成功,后面找了很久才找到原因,这都是没有一个详细的环境调试导致,所以今天特出一个详细的教程,一步一步从环境调试到代码实现整一个教程,希望对还在苦苦寻找解决方法却迟迟不能得到有效解决的人员一点帮助。SMTP协议首先了解SMTP(简单邮件传输协议),邮件传送...

View Article

python logging 日志轮转文件不删除问题的解决方法

前言最近在维护项目的python项目代码,项目使用了 python 的日志模块 logging, 设定了保存的日志数目, 不过没有生效,还要通过contab定时清理数据。分析项目使用了 logging 的 TimedRotatingFileHandler :#!/user/bin/env python# -*- coding: utf-8 -*-import loggingfrom...

View Article


python中的字典使用分享

字典中的键使用时必须满足一下两个条件:1、每个键只能对应一个项,也就是说,一键对应多个值时不允许的(列表、元组和其他字典的容器对象除外)。当有键发生冲突时(即字典键重复赋值),取最后的赋值。复制代码 代码如下:>>> myuniversity_dict = {'name':'yuanyuan', 'age':18, 'age':19, 'age':20,...

View Article

Python随机生成数据后插入到PostgreSQL

用python随机生成学生姓名,三科成绩和班级数据,再插入到PostgreSQL中。模块用psycopg2 randomimport randomimport...

View Article


python3新特性函数注释Function Annotations用法分析

本文分析了python3新特性函数注释Function Annotations用法。分享给大家供大家参考,具体如下:Python 3.X新增加了一个特性(Feature),叫作函数注释 Function Annotations它的用途虽然不是语法级别的硬性要求,但是顾名思义,它可做为函数额外的注释来用。Python中普通的函数定义如下:def func(a, b, c): return a + b...

View Article

Image may be NSFW.
Clik here to view.

How to Develop Your First XGBoost Model in Python with scikit-learn

XGBoost is an implementation of gradient boosted decision treesdesigned for speed and performance that is dominative competitive machine learning. In this post you will discover how you can install and...

View Article


Image may be NSFW.
Clik here to view.

Root finding in MATLAB, R, Python and C++

In dynamical systems, we are often interested in finding stable points, or equilibria. Some systems have multiple equilibria. As an example, take the lake problem, which is modeled by the equation...

View Article

Image may be NSFW.
Clik here to view.

Precipitation animations with GRASS-GIS and python

The National Center for Atmospheric Research (NCAR) supplies climate forecast data online, with four daily updates. Why not use the power of GRASS-GIS and python to produce animations of predicted...

View Article

Package of the Week: Pendulum

Pendulum is a python library to make your life easier when it comes down to work with date/time. Installation pip install pendulum A few dependencies will be installed: pytz , tzlocal and...

View Article
Browsing all 9596 articles
Browse latest View live