多看上的收费书
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| # 转换HTML类名 | |
| def lines(file): | |
| for line in file: yield line | |
| yield '\n' | |
| def blocks(file): | |
| ''' | |
| 按照"块(空行分块)"读取文本 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| class Cfunc(object): | |
| """Count function | |
| """ | |
| def __init__(self, func): | |
| super(Cfunc, self).__init__() | |
| self.count = 0 | |
| self.func = func | |
| def f(self, *pargs, **kargs): | |
| self.count += 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var a = document.getElementsByClassName("grid-cell"); | |
| var t = document.getElementsByClassName("tile-container")[0]; | |
| var old = document.getElementsByClassName("tile-new"); | |
| var msg = document.getElementsByClassName("game-message")[0]; | |
| var o = [], x = []; | |
| var ot = true; | |
| var player = 1; | |
| for (var i = 8; i >= 0; x[i] = false, o[i--] = false); | |
| for(var i = 0, len1 = a.length; i < len1; i++){ | |
| a[i].onclick = function () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # update 2014-06-19 18:51 | |
| # Section Start: dropbox | |
| 108.160.166.62 dropbox.com | |
| 108.160.165.62 dropbox.com | |
| 205.251.196.138 dropbox.com | |
| 108.160.166.20 www.dropbox.com | |
| 108.160.167.204 www.dropbox.com | |
| 108.160.166.13 www.dropbox.com | |
| 108.160.165.147 www.dropbox.com | |
| 108.160.167.208 www.dropbox.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| def f1(): | |
| X = 88 | |
| def f2(): | |
| print X | |
| return f2 | |
| action = f1() | |
| action() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| def tieTacToe(x, o): | |
| L = [{0,1,2},{3,4,5},{6,7,8}, | |
| {0,3,6},{1,4,7},{2,5,8}, | |
| {0,4,8},{2,4,6} | |
| ] | |
| moves = [not x[i] and not o[i] for i in xrange(9)] | |
| wins = [False for i in xrange(9)] | |
| blocks = [False for i in xrange(9)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| class Person(): | |
| def __init__(self, name): | |
| self._name = name | |
| self.originalName = name | |
| def getName(self): | |
| print('fetch...') | |
| return self._name | |
| # def setName(self, value): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| # Output example: [>>>>>>> ] 75% | |
| # width defines bar width | |
| # percent defines current percentage | |
| def progress(width, percent): | |
| print "%s %d%%\r" % (('%%-%ds' % width) % (width * percent / 100 * '>'), percent), | |
| if percent >= 100: | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| """ | |
| reference: [Algorithm X in 30 lines!](http://www.cs.mcgill.ca/~aassaf9/python/algorithm_x.html) | |
| """ | |
| def solve(X, Y, solution=[]): | |
| ''' for example: | |
| X = { | |
| 1: {'A', 'B'}, | |
| 2: {'E', 'F'}, | |
| 3: {'D', 'E'}, |