/** * KVC -- Key Value Coding (键值编码) *
1、KVC是一种间接访问对象实例变量的方式,使用该机制不需要调用存取方法和变量实例就可以访问对象的属性 * KVC
方法存在于NSKeyValueCoding中,默认实现方式由NSObject提供 * KVC ...
分类:
移动开发 时间:
2014-05-09 16:23:57
阅读次数:
376
在上一篇中,使用scrapy修改源IP发送请求的最后我们提到由于hosts文件不支持正则,会导致我们的随机域名DNS查询失败。是用DNS服务器可以解决这个问题,下面是我用gevent写的小工具,很简单。我们只拦截匹配的A记录,然后发送DNS Response,如果不匹配,那么我们服务器就是一个DNS代理,转发请求。# -*- coding=utf-8 -*-
import struct
from...
分类:
编程语言 时间:
2014-05-09 13:49:34
阅读次数:
560
本文均来自PythonCookbook,本博文励志将Cookbook中的string部位,文件,面向对象编程部分完成,本系列博文陆续还会介绍flask框架,每篇博文都以一个个小例子展示。#-*-coding:utf-8-*-
‘‘‘
windows下修改文件属性
‘‘‘
importwin32con,win32api,os
#创建一个文件,并展示如何操..
分类:
编程语言 时间:
2014-05-09 07:02:03
阅读次数:
364
为什么归并排序如此有用?1.
快捷和稳定归并排序成为?一个非常棒的排序算法主要是因为它的快捷和稳定。它的复杂度即使在最差情况下都是O(n log
n)。而快速排序在最差情况下的复杂度是O(n^2),当n=20的时候,它比归并要慢4.6倍。2.容易实现#coding:utf-8def merge_so...
分类:
编程语言 时间:
2014-05-09 03:44:58
阅读次数:
386
# -*- coding: utf-8 -*-
try:
import httplib2
except ImportError:
print('错误:')
print(' httplib2这个XML解析库没有找到,程序无法继续执行!')
exit(255)
def network_get_proc(self, use_cache = True):
'''POST动作'...
分类:
编程语言 时间:
2014-05-09 01:39:09
阅读次数:
337
简单的python发送html邮件代码,如下:#!/usr/bin/envpython
#-*-coding:utf-8-*-
importsmtplib
fromemail.headerimportHeader
fromemail.MIMETextimportMIMEText
fromemail.mime.multipartimportMIMEMultipart
############################################################..
分类:
编程语言 时间:
2014-05-09 00:57:45
阅读次数:
415
1,创建一个user表,包含两列name,phone
2,用python(你喜欢的任何语言)插入100W条记录(lz的笔记本比较老,大概用了1分钟吧):
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import MySQLdb
conn = MySQLdb.connect(host='localhost',user='root',db='mi...
分类:
数据库 时间:
2014-05-08 15:52:43
阅读次数:
393
Downloading the module:sudo apt-get install
python-tksimple example:#!/usr/bin/python# -*- coding: utf-8 -*-"""ZetCode
Tkinter tutorialThis script sho...
分类:
编程语言 时间:
2014-05-07 14:46:05
阅读次数:
454
CareerCup
目录
Chapter 1 | Arrays and Strings
1.1 Implement an algorithm to determine if a string has all unique characters. What if you can not use additional data structures?
1.2 Write co...
分类:
其他好文 时间:
2014-05-07 04:25:44
阅读次数:
320
最近下了《中国式英语口语纠错》里面的文件都是“tingvoa.com_cnusa043.mp3”,MP3播放器不识别,
因此用python脚本写了一个rename的脚本
# -*- coding: utf-8 -*-
import os
def filerename(path):
for file in os.listdir(path):
#pr...
分类:
编程语言 时间:
2014-05-06 22:48:40
阅读次数:
423