#!/usr/bin/python
# -*- coding: utf-8 -*-
#6–5. 字符串
# (a)更新你在练习2-7 里面的方案,使之可以每次向前向后都显示一个字符串的一个字符.
# (b)通过扫描来判断两个字符串是否匹配(不能使用比较操作符或者cmp()内建函数)。
# 附加题:在你的方案里加入大小写区分.
# (c)判断一个字符串是否重现(后面跟...
分类:
编程语言 时间:
2014-05-26 05:45:39
阅读次数:
420
美妙的Python之一Python简介 前言:开启美妙的Python之旅。...
分类:
编程语言 时间:
2014-05-26 05:01:18
阅读次数:
380
说明
本实例能够监控聚划算的抢购按钮,在聚划算整点聚的时间到达时发出提醒(音频文件自己定义位置)并自动弹开页面(URL自己定义)。
同时还可以通过命令行参数自定义刷新间隔时间(默认0.1s)和监控持续时间(默认1800s)。
源码
# encoding: utf-8
'''
@author: Techzero
@email: techzero@163.com
@time: 2014-5-1...
分类:
编程语言 时间:
2014-05-26 04:14:41
阅读次数:
381
PS:接上一篇 本文摘自OSchina Linuxqueen
不幸的是,这样做看上去似乎不太可能。即使是我们有神奇的函数,可以让我们从n遍历到无限大,我们也会在返回第一个值之后卡住:
1
def get_primes(start):
2
for element in magical_infinite_ra...
分类:
编程语言 时间:
2014-05-26 04:07:40
阅读次数:
366
tar
Examples:
tar -cf archive.tar foo bar # Create archive.tar from files foo and bar.
tar -tvf archive.tar # List all files in archive.tar verbosely.
tar -xf archive.tar ...
Summation of primes
Problem 10
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.
还是使用Sieve of Eratosthenes 算法
我的python代码如下:
...
分类:
其他好文 时间:
2014-05-26 03:40:15
阅读次数:
243
PS:硬说原创 我只能说自己太不要脸了 就当是个搬运工吧 希望对您有帮助
先来看看基础的---重头戏在后面:
yield的英文单词意思是生产,刚接触Python的时候感到非常困惑,一直没弄明白yield的用法。
只是粗略的知道yield可以用来为一个函数返回值塞数据,比如下面的例子:
def addlist(alist):
for ...
分类:
编程语言 时间:
2014-05-24 23:44:49
阅读次数:
621
题目
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.
Here, we will use the i...
分类:
其他好文 时间:
2014-05-24 20:30:21
阅读次数:
342
【题目】
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.
Given an integer n, return all distinct solutions to the n-queens puzzle.
Each solution contains a distinct board configuratio...
分类:
其他好文 时间:
2014-05-24 17:12:32
阅读次数:
237